Nginx subdirectory proxy, repeated subfolder name (error 404)

I am running nginx reverse-proxy on my server, intending to navigate the request www.example.com to localhost:8800/example so I wrote this in nginx.conf

server {
    listen  80;
    server_name www.example.com;
    location / {
        root /;
        proxy_redirect off;
        proxy_set_header Host $host;  
        proxy_set_header   X-Real-IP   $remote_addr;  
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass  http://localhost:8880/example/;
    }
}

When I try to access http://www.example.com/index.php, the proxy works fine. However, when the request address comes with subfolders, say http://www.example.com/wp-admin/, my server response with 404 error and I can see from my IIS the request address is changed to http://localhost:8880/example/example/wp-admin/.

Read More

Any help please?

Related posts

Leave a Reply