Skip to content

Instantly share code, notes, and snippets.

@jczaplew
Created November 21, 2014 17:45
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jczaplew/11c7cc545e4d2081dd8a to your computer and use it in GitHub Desktop.
Save jczaplew/11c7cc545e4d2081dd8a to your computer and use it in GitHub Desktop.
Node + Apache
<VirtualHost *:80>
ServerName app.myurl.com
ProxyRequests off
<Proxy *>
Order allow,deny
Allow from all
</Proxy>
# This says if someone goes to app.myurl.com, forward the request to port :8080, which is where your Node app is running
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
ProxyPreserveHost on
</VirtualHost>
# Install pm2 - a way to daemonize a Node process
sudo npm install -g pm2
# Install n, a Node version manager
sudo npm install -g n
# Use the latest version of node (0.11.x)
sudo n latest
pm2 start /path/to/app/server.js --name MyApp
# Restart Apache after adding the Vhost, and you should be good to go!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment