fast-cgi Oddness
CJ Ess
zxcvbn4038 at gmail.com
Thu Feb 13 20:46:53 UTC 2020
I am running with Nginx 1.16. I have a really simple configuration for
wordpress, seen below.
I have one test case:
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 I hard code SCRIPT_NAME to $request_uri and SCRIPT_FILENAME
to $document_root$request_uri then failing test case works which I think
shows the script would work if the path were set correctly, but the first
test case fails because index.html doesn't get added to $request_uri.
I can't find anything similar searching Google, does anyone have a solution
or workaround?
server {
listen 80;
server_name x.com;
index index.php;
if (!-e $request_filename) {
rewrite ^/[_0-9a-zA-Z-]+(/wp-(content|admin|includes).*) $1 break;
rewrite ^/[_0-9a-zA-Z-]+(/.*\.php)$ $1 break;
}
location ~* (.*\.(js|css|svg|png|gif|ttf|woff|woff2))$ {
root /x/wordpress;
index index.html index.htm index.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;
fastcgi_param aetn_env devtest;
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20200213/9445be6c/attachment.htm>
More information about the nginx
mailing list