I would like to run a meteor.js app in a subfolder (/home/www/public/v1
) of a domain (/home/www/public
) served by an Apache (2.4.7) server.
I have set up a virtualhost which listens to port 80, and proxies locations starting with "v1" to the nodejs app.
It works fine (I think) except that I get a 404 page generated by meteor.js.
Must I modify the meteor.js setup to accept requests coming from "domain.tld/v1" instead of "domain.tld" ? If so, which file(s)? Is this sort of setup possible at all?
The virtualhost configuration (edited for legibility)
<VirtualHost *:80>
ServerName domain.tld
DocumentRoot /home/username/www/domain.tld/public
<Directory />
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
<Directory /home/username/www/domain.tld/public/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from All
Require all granted
</Directory>
# NODEJS APP in V1 FOLDER
ProxyRequests on
<Proxy *>
Order deny,allow
Allow from all
Require all granted
</Proxy>
<Location "/v1/">
ProxyPreserveHost on
ProxyPass http://localhost:3000/
ProxyPassReverse http://localhost:3000/
</Location>
</VirtualHost>
Best Answer
Configuration
You configuration is correct but some options are outdated and other not needed:
Meteor.js will be redirected from port 3000/v1 to port 80/v1
More info:
This no more exist in Apache 2.4
This is needed when you got restriction
This will make your server to proxy any request, and it is not required for what you need (https://httpd.apache.org/docs/2.4/en/mod/mod_proxy.html#proxyrequests)
This is optional in your case (https://httpd.apache.org/docs/2.4/en/mod/mod_proxy.html#proxypreservehost)