Node.js doesn’t need apache to run but if you’re running a node.js script on the same server along side the rest of your website we can set this up with some basic apache config.
Node.js will probably be running on it’s own port so make note of what that is.
Take a look at your apache http.d config file to make sure the following two lines aren’t commented out. These two lines will enable two apache modules “proxy” and “proxy_http”
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
The next step is to edit the virual host file and add the ProxyPass rule.
ProxyPass /node http://example.com:8080
This will make example.com/node load up the nodejs script running on port 8080.
By setting up a node script like this we can run a nodejs script along side a PHP website on the same server. Perfect for small projects.
Posted by Adi on November 25, 2016