How can I make Meteor serve from a folder instead of the domain?
i.e. I’m trying to serve Meteor from a subfolder of the domain. Something like:
abc.com
: nginx + php-fpm
abc.com/xyz
: Meteor app
abc.com/xyz/admin
: another Meteor app
I’ve been looking into how to achieve this, and none of the resources and/or samples I could get my hands on even mentions running a Meteor app as a folder under a domain.
I got the nginx side working, with the config below (I’m giving the full config, in case I’m doing something wrong):
location ^~ /xyz/ {
location ^~ /xyz/admin/ {
location ~* \.(?:css|gif|jpe?g|ico|js|png|otf|svg|ttf|woff)$ {
root /home/trying/xyz/admin-website/public;
expires 1w;
access_log off;
add_header Pragma public;
add_header Cache-Control "public";
}
proxy_pass http://localhost:8030;
proxy_set_header X-Real-IP $remote_addr;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
if ($uri != '/') {
expires 30d;
}
}
location ~* \.(?:css|gif|jpe?g|ico|js|png|otf|svg|ttf|woff)$ {
root /home/trying/xyz/customer-website/public;
expires 1w;
access_log off;
add_header Pragma public;
add_header Cache-Control "public";
}
proxy_pass http://localhost:8031;
proxy_set_header X-Real-IP $remote_addr;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
if ($uri != '/') {
expires 30d;
}
}
I’m seeing the nginx proxying the requests to Meteor:
2016/05/04 11:57:36 [error] 16418#0: *156 open() "/home/trying/xyz/packages/jparker_crypto-md5.js" failed (2: No such file or directory), client: 94.102.75.38, server: www.jupytur.com, request: "GET /packages/jparker_crypto-md5.js?hash=4b8c0bf83206d5e0f92aafe2820bb160e35f1627 HTTP/1.1", host: "www.jupytur.com", referrer: "https://www.jupytur.com/sociatips/"
2016/05/04 11:57:36 [error] 16418#0: *149 open() "/home/trying/xyz/packages/meteorhacks_ssr.js" failed (2: No such file or directory), client: 94.102.75.38, server: www.jupytur.com, request: "GET /packages/meteorhacks_ssr.js?hash=809d34fd56a22d08a4d4a531d3855419aa097095 HTTP/1.1", host: "www.jupytur.com", referrer: "https://www.jupytur.com/sociatips/"
2016/05/04 11:57:36 [error] 16418#0: *152 open() "/home/trying/xyz/packages/session.js" failed (2: No such file or directory), client: 94.102.75.38, server: www.jupytur.com, request: "GET /packages/session.js?hash=9ac45190b217c0c6a6293b0769e5a83f9dc8c003 HTTP/1.1", host: "www.jupytur.com", referrer: "https://www.jupytur.com/sociatips/"
Simply put, I can’t figure out how to have Meteor serve from abc.com/xyz/ instead of abc.com. How do I achieve this?