nginx + php-fpm: REQUEST_URI disappears for files that end with .php
ST
smntov at gmail.com
Thu Mar 8 11:48:41 UTC 2018
Hello,
I have following nginx + php-fpm configuration but for some reasons
files that end with .php miss REQUEST_URI when they arrive to php-fpm.
For instance:
https://n.example.com/audio/radio/ -> array(1)
{ ["REQUEST_URI"]=> string(15) "/audio/radio/" }
https://n.example.com/rus_example.html -> array(1)
{ ["REQUEST_URI"]=> string(15) "rus_example.html" }
https://n.example.com/rus_example.php -> array(0) { }
What is wrong?
Thank you!
Here is my configuration:
location / {
try_files $uri $uri/ @netcat-rewrite;
}
location @netcat-rewrite {
rewrite ^/(.*)$ /netcat/require/e404.php?REQUEST_URI=$1 last;
}
error_page 404 = /netcat/require/e404.php;
location ~ \.php$ {
if ($args ~ "netcat_files/") {
expires 7d;
add_header Cache-Control "public";
}
fastcgi_split_path_info ^(.+\.php)(/.+)$;
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root
$fastcgi_script_name;
fastcgi_param DOCUMENT_URI $document_uri;
include fastcgi_params;
}
PHP-FPM log:
no .php file:
08/Мар/2018:13:44:13 +0200
"GET /netcat/require/e404.php?REQUEST_URI=audio/radio/" 200
.php file:
08/Мар/2018:13:44:14 +0200 "GET /netcat/require/e404.php" 404
More information about the nginx
mailing list