Nginx php reverse proxy problem

Francis Daly francis at
Tue Feb 18 23:37:45 UTC 2020

On Wed, Feb 12, 2020 at 07:43:11AM -0500, adrian.hilt wrote:

Hi there,

> I'm running a reverse proxy with nginx and using certbot for ssl. It's been
> working great but recently with an php server installation it's been giving
> me problems.
> I get access to the index but any other page I get a 404 error from nginx.

>     location /site/ {
>       if (!-e $request_filename){
>         rewrite ^/site/(.*)$ /site/index.php break;
>       }

You might be happier there with "last" instead of "break".

But you might be happier still, replacing the three lines with something

    try_files $uri $uri/ /site/index.php;

which is the usual nginx way to "fall back" to php processing.

Good luck with it,

Francis Daly        francis at

More information about the nginx mailing list