Welcome! Log In Create A New Profile

Advanced

nginx + php-fpm: REQUEST_URI disappears for files that end with .php

ST
March 08, 2018 06:50AM
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

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

nginx + php-fpm: REQUEST_URI disappears for files that end with .php

ST March 08, 2018 06:50AM

Re: nginx + php-fpm: REQUEST_URI disappears for files that end with .php

Francis Daly March 08, 2018 07:02PM

Re: nginx + php-fpm: REQUEST_URI disappears for files that end with .php

ST March 09, 2018 04:42AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 303
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