Welcome! Log In Create A New Profile

Advanced

fast-cgi Oddness

CJ Ess
February 13, 2020 03:48PM
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;
}
}
_______________________________________________
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: 268
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