Welcome! Log In Create A New Profile

Advanced

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" "http://127.0.0.1/wp-admin/"
> 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" "http://127.0.0.1/wp-admin/load-styles.php"
> 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
/load-styles.php.

> 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 127.0.0.1:9000;
> 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?

f
--
Francis Daly francis@daoine.org
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
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: 296
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready