Setting up Apache Proxy to Serve Node Application
Set up proxy
Install build essentials then:
aptitude install -y libapache2-mod-proxy-html libxml2-dev
Enable apache modules:
a2enmod
Then it will ask you for the names of the modules that you want to enable:
proxy proxy_ajp proxy_http rewrite deflate headers proxy_balancer proxy_connect proxy_html
Then your vhost file will look like this:
<VirtualHost *:80>
ServerAdmin web@domain.com
ServerName domain.com
ServerAlias www.domain.com
ProxyRequests off
ProxyPass / http://localhost:2368/
ProxyPassReverse / http://localhost:2368/
# DocumentRoot /srv/www/domain.com/public_html/
# ErrorLog /srv/www/domain.com/logs/error.log
# CustomLog /srv/www/domain.com/logs/access.log combined
</VirtualHost>
Load balancing
Running ghost forever
http://support.ghost.org/deploying-ghost/
To install forever type npm install forever -g
To start Ghost using forever from the Ghost installation directory type NODE_ENV=production forever start index.js
To stop Ghost type forever stop index.js
To check if Ghost is currently running type forever list