nginx: proxy all traffic to apache

Sometimes you need to add nginx frontend beside apache webserver. In my case I have tons of websites where visitors are very rare. Further I’m too lazy to write configuration files for each virtual host in nginx. On other side I want to proxy some traffic to another webservers such as nodejs applications or just serve static content.

\"nginx-apache\"

In this case I assume that your apache2 listening for connections on 127.0.0.1:8080, ie in config file of apache:

/etc/apache2$ cat ports.conf
Listen 8080

Make sure all your VitrualHost binded to port 8080

Read more