Using Apache as a Proxy for Node JS Applications on Debian

I have a NodeJS application running on port (for example) 7070 e.g. http://localhost:7070

I also have Apache2 installed.

I want to get all requests to http://localhost to be handled by the NodeJS appliaction running on 7070 (express.io app.listen(7070); ).

Install Apache2 if not already installed….

sudo apt-get install apache2

Enable proxy module

sudo a2enmod proxy

Enable proxy_http module

sudo a2enmod proxy_http

Create file /etc/apache2/conf-available/node.conf

sudo nano /etc/apache2/conf-available/node.conf

Add the following:

ProxyPass / http://localhost:7070/

Tell Apache about the proxy configuration with:

sudo a2enconf node

Restart Apache for the changes to be effective:

sudo service apache2 reload

Browse to http://localhost should now direct requests to http://localhost:7070