I have deployed my nodejs app on a VPS(ubuntu 10.04). I have hosted it on a subdomain (subdomain.myapp.com:3000) and I just have one IP address
By default port 80 is
Just an update of @drinchev answer with Apache 2.4.*
Enable the proxy mode :
a2ensite proxy_http
a2ensite proxy
Then :
<VirtualHost *:80>
ServerName subdomain.myapp.com
ProxyRequests off
<Proxy *>
Require all granted
</Proxy>
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/
ProxyPreserveHost on
</VirtualHost>
Yes it is possible
In your apache virtual host file configure with the following
<VirtualHost *:80>
ServerName subdomain.myapp.com
ProxyRequests off
<Proxy *>
Order allow,deny
Allow from all
</Proxy>
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/
ProxyPreserveHost on
</VirtualHost>
You should have
NameVirtualHost *:80
on top of your file and also Proxy module installed for apache ( I think it is a default configuration for ubuntu )
LoadModule proxy_module lib/httpd/modules/mod_proxy.so
it must be in your httpd.conf file
then you should restart apache and it must be fine!
I needed to do the same thing and @drinchev's answer almost worked for me, but because I run several vhosts on my dev box it didn't quite. A couple minor tweaks kept it from clobbering all my other vhosts.
<Proxy *>
Needed to be
<Proxy mynodejs.mydevbox.local>
And
<VirtualHost *:80>
Needed to be
<VirtualHost mynodejs.mydevbox.local:80>
So where my local dev machine is named "mydevbox.local" and my node vhost is listening on port 3000, my final config looked more like:
<VirtualHost mynodejs.mydevbox.local:80>
DocumentRoot "/Library/WebServer/Documents/mynodejs"
ServerName mynodejs.mydevbox.local
ServerAlias mynodejs.mydevbox.local
ProxyRequests off
<Proxy mynodejs.mydevbox.local>
Order allow,deny
Allow from all
</Proxy>
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/
ProxyPreserveHost on
ErrorLog "/private/var/log/apache2/mynodejs_error_log"
CustomLog "/private/var/log/apache2/mynodejs_access_log" common
</VirtualHost>
<VirtualHost myothervhost.mydevbox.local:80>
DocumentRoot "/Library/WebServer/Documents/myothervhost"
ServerName myothervhost.mydevbox.local
ServerAlias myothervhost.mydevbox.local
ErrorLog "/private/var/log/apache2/myothervhost_error_log"
CustomLog "/private/var/log/apache2/myothervhost_access_log" common
</VirtualHost>
Other vhosts could follow