nginx, php-fpm, 404

Maxim Dounin mdounin at
Tue May 29 12:36:16 UTC 2018


On Tue, May 29, 2018 at 11:01:43AM +0200, rainer at wrote:


> However, when I call the URL /install as suggested by the documentation
> I get redirected to /install/
> and for that URL, I get a 404.
> It seems, PHP-FPM isn't even called.
>  From the error-log (with debug-option):
> 2018/05/29 11:01:17 [notice] 94022#0: *1805515 "^/install(/?.*)" matches 
> "/install/", client: a.b.c.d, server: nghsbrtest.bla.dom, request: "GET 
> /install/ HTTP/1.1", host: "nghsbrtest.bla.dom"
> 2018/05/29 11:01:17 [notice] 94022#0: *1805515 rewritten data: 
> "/install.php/", args: "", client: a.b.c.d, server: nghsbrtest.bla.dom, 
> request: "GET /install/ HTTP/1.1", host: "nghsbrtest.bla.dom"
> I can't seem to get my head around this. It should match the 
> php-location, shouldn't it?

The rewritten URL is "/install.php/", which cannot be handled by 
the specified PHP location because it requires at least one 
character after "/" in fastcgi_split_path_info:

>          fastcgi_split_path_info ^(.+\.php)(/.+)$;

and then tests the resulting $fastcgi_script_name using try_files:

>          try_files $fastcgi_script_name =404;

It will try to test if the "/install.php/" file exists, and since 
it's not, it will return 404.

>From the configuration it is not clear why you are redirected to 
"/install/" though.  With bare "/install" without trailing slash I 
would expect the provided configuration to work.  You may want to 
check what actually happens with "/install" request.  The most 
trivial explanation - an incorrect response returned in some 
prevrious tests with a different configuration might be cached by 
your browser.

Maxim Dounin

More information about the nginx mailing list