Nginx php reverse proxy problem

Francis Daly francis at daoine.org
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".

http://nginx.org/r/rewrite

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

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

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

Good luck with it,

	f
-- 
Francis Daly        francis at daoine.org


More information about the nginx mailing list