Welcome! Log In Create A New Profile


Re: fast-cgi Oddness

Francis Daly
February 18, 2020 03:14PM
On Thu, Feb 13, 2020 at 03:46:53PM -0500, CJ Ess wrote:

Hi there,

> curl -H "Host: x.com" ""
> Which succeeds - I can see in the php-fpm log that it does "GET
> /wp-admin/index.php"
> I have a second test case:
> curl -H "Host: x.com" ""
> Which unexpectedly returns a 404 error, even though the file does exist at
> wp-admin/load-styles.php, but in the php-fpm log I am seeing GET
> /load-styles.php

> I can not figure out why the path is altered for the failing test case and
> not the passing one.

> if (!-e $request_filename) {
> rewrite ^/[_0-9a-zA-Z-]+(/wp-(content|admin|includes).*) $1 break;
> rewrite ^/[_0-9a-zA-Z-]+(/.*\.php)$ $1 break;
> }

Assuming that /usr/local/nginx/html/wp-admin does not exist:

/wp-admin/ does not match either rewrite, so is unchanged.

/wp-admin/load-styles.php matches the second, so is rewritten to

> location / {
> rewrite ^/wp-admin$ /wp-admin/ permanent;
> root /x;
> index index.php;
> try_files $uri @wordpress;
> }
> location @wordpress {
> root /x/wordpress;
> include /etc/nginx/fastcgi_params;
> fastcgi_pass;
> fastcgi_index index.php;
> fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

That is /x/wordpress/wp-admin/index.php in the first case, and
/x/wordpress/load-styles.php in the second.

Why do the first rewrites exist? Are they breaking your setup?

Francis Daly francis@daoine.org
nginx mailing list
Subject Author Posted

fast-cgi Oddness

CJ Ess February 13, 2020 03:48PM

Re: fast-cgi Oddness

Francis Daly February 18, 2020 03:14PM

Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 97
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready