I want to setup nginx as a reverse proxy for apache. I have apache on port 8080. It works only for the root path, for example https://www.example.com, but it won't work for https://www.example.com/index.html
location / {
try_files $uri $uri/ /index.php;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:8080;
}
I tried adding slash to the address, like http://127.0.0.1:8080/ but then I got config error. Something like here: https://stackoverflow.com/questions/21662940/nginx-proxy-pass-cannot-have-uri-part-in-location I tried to use the rewrite, but I don't know what should this rewrite be.
Best Answer
Try the below for nginx reverse proxy