Я использую nginx с PHP-FPM
Мое приложение требует, чтобы все URL-адреса были перенаправлены на index.php
(см. nginx conf)
location / {
root /var/www/app/public/
try_files $uri /index.php?$args;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
try_files $fastcgi_script_name =404;
set $path_info $fastcgi_path_info;
fastcgi_param PATH_INFO $path_info;
fastcgi_index index.php;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
}
Чтобы проанализировать некоторые проблемы с производительностью, я хотел использовать страницу статуса fpm. Но на странице состояния не отображается настоящий URI запроса.
pid: 1369
state: Idle
start time: 03/Sep/2018:17:34:34 +0200
start since: 15
requests: 4
request duration: 29796
request method: GET
request URI: /index.php
content length: 0
user: -
script: /var/www/app/public/index.php
last request cpu: 67.12
last request memory: 6291456
Так что трудно сказать, какая страница обрабатывается в данный момент - возможно ли добавить дополнительную информацию на страницу fpm-status или изменить URI запроса?
Для моего решения проблемы было:
fastcgi_param PATH_INFO $request_uri;
Вы должны добавить блок в отдельный блок с fastcgi_index
устанавливать:
location ~ ^/_status$ {
include fastcgi_params
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_index index.php;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
# the following is optional but nice to have
# it will restrict access to the local monitoring system
access_log off;
allow 127.0.0.1;
allow ::1;
deny all;
}