(update) having problems with this when using socket.io from external clients. So it may be worth looking at the alternatives described in the Shelley Powers book on NODE.js
original post
Here is now to set up a reverse proxy so that a node.js server is visible from the outside world. In our case we redirected any traffic with the subdirectory /nodejs/ to port 8124
for example, this web address http://zerokidz.com/nodejs/
Add the following to the /etc/apache2/sites-enabled/default file: (inside the section already set aside for the virtual host zerokidz)
ProxyPass /nodejs/ http://127.0.0.1:8124/ ProxyPassReverse /nodejs/ http://127.0.0.1:8124/ <Proxy *> Order deny,allow Allow from all </Proxy>
So it will look something like this:
<VirtualHost *:80> ServerName www.zerokidz.com ServerAlias zerokidz.com *.zerokidz.com DocumentRoot /home/tkzic/public_html/zerokidz # Nodejs reverse proxy rule # sends all traffic for zerokidz.com/nodejs # to the nodejs server on port 8124 ProxyPass /nodejs/ http://127.0.0.1:8124/ ProxyPassReverse /nodejs/ http://127.0.0.1:8124/ <Proxy *> Order deny,allow Allow from all </Proxy> </VirtualHost>
Then restart apache, of course