Nginx reverse proxy not passing through root (/)

Posted on

Nginx reverse proxy not passing through root (/) – Managing your servers can streamline the performance of your team by allowing them to complete complex tasks faster. Plus, it can enable them to detect problems early on before they get out of hand and compromise your business. As a result, the risk of experiencing operational setbacks is drastically lower.

But the only way to make the most of your server management is to perform it correctly. And to help you do so, this article will share nine tips on improving your server management and fix some problem about apache-2.2, nginx, debian, reverse-proxy, .

I have set up Nginx as a reverse proxy to Apache on a web server.

Nginx is listening on and passing through to

This all seems to be working fine, except when I first load the site at the root level (i.e. nginx is not passing through to Apache, instead displaying the ‘Welcome to Nginx!’ page.

If I CTRL+F5 it will pass through to Apache, also passes through to Apache if I load any other pages on the site..

My vhost is set up as follows:

server {
    access_log /var/log/nginx/default.access.log;

    location / {
    include /etc/nginx/proxy_params;

My proxy_params is set up as follows:

proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

Any help on this one is greatly appreciated!

Solution :

Ok, managed to fix this by adding the following to proxy_params:

proxy_redirect off;

Not really sure why this would fix it, but it did!

Leave a Reply

Your email address will not be published.