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;


I tried adding slash to the address, like 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.

  • You should remove the try_files statement. – Richard Smith Jun 1 '17 at 19:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.