404 error on homepage when using Nginx proxying to Apache

Both servers are listening to the same port. You have Nginx set to listen to 80 and nothing is set for Apache unless it’s in your ports.conf.

Your also proxy passing to Apache port 80 in your Nginx conf.

In the Nginx conf change

proxy_pass http://127.0.0.1:80;

to

proxy_pass http://127.0.0.1:9000;

change listen XXX.XXX.XXX.XXX:80; to listen 80;

In your Vhosts

add

NameVirtualHost *:9000
Listen 9000

Above the <VirtualHost> tag or in the ports.conf file (If you have other vhost that don’t use Nginx add it to the top of your vhost. Change virtual host to look like this:

<VirtualHost *9000>

Leave a Comment