Skip to content

Instantly share code, notes, and snippets.

@iMagdy
Last active February 25, 2020 00:46
Show Gist options
  • Save iMagdy/6117502 to your computer and use it in GitHub Desktop.
Save iMagdy/6117502 to your computer and use it in GitHub Desktop.
This virtualhosts snippet will make your nodejs app run on the traditional port 80, so mynodeapp.com:3000 will simply work on mynodeapp.com without adding :3000. it's that simple :) remember to enable apache modules proxy and proxy_http ($ sudo a2enmod proxy && sudo a2enmod proxy_http)
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName js.io
ServerAlias js.io
ProxyRequests off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
<Location />
ProxyPass http://127.0.0.1:3000/
ProxyPassReverse http://127.0.0.1:3000/
</Location>
DocumentRoot /var/www/
</VirtualHost>
@coalwater
Copy link

What is this part for ?

<Proxy *>
    Order deny,allow
    Allow from all
</Proxy>

@coalwater
Copy link

Rename the gist to "node_apache.apacheconf" to get syntax highlighting, and change the indentation to 4 instead of 5, more standard, example here, too bad pull requests are not available in gists.

@iMagdy
Copy link
Author

iMagdy commented Sep 9, 2013

All done :) Thanks for the feedback.. Sorry for being too late to reply on this...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment