coderwall.com : establishing geek cred since 1305712800


I've been interested in learning Node.js and for a few times I've studied it but never finished a project or at least didn't had the time! A few days ago, after doing some research about the "NoBackend" concept, I got inspired and installed "Deployd" in my server and test it with very good results: very fast development, focus on the client-side, etc. I'm interested in using this technology in my next project, so I did some research about how to put a Node.js app alongside with my other apps hosted in my Apache Server. I found a nice solution based on reverse-proxy withing Apache 2 - there's other ways, but for small traffic sites this should be ok. 1) Enable the Apache proxy modules. I'm using Ubuntu 12.04 LTS, so I edit /etc/apache2/httpd.conf and add the following:
LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so LoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.so 
1.1) I've assumed you've got the 2 modules installed and enabled:
ln -s /etc/apache2/mods-available/proxy.load /etc/apache2/mods-enabled ln -s /etc/apache2/mods-available/proxy_http.load /etc/apache2/mods-enabled 
2) Now, edit your vhost and add the new directives:
<VirtualHost *:80> ServerAdmin [email protected] ServerName yourdomain.com ServerAlias www.yourdomain.com ProxyRequests off ProxyPass / http://localhost:3000/ ProxyPassReverse / http://localhost:3000/ </VirtualHost> 
3) Restart apache2
service apache2 restart 
    https://coderwall.com/p/-3llka/node-js-running-alongside-apache2

Leave a comment


Scroll to Top