简体   繁体   English

Nginx网站的PHP-FPM状态页面返回“找不到文件”

[英]Nginx site for PHP-FPM status page returns “File not found”

In /etc/php/7.1/fpm/pool.d/www.conf I have set pm.status_path = /status . /etc/php/7.1/fpm/pool.d/www.conf我已设置pm.status_path = /status And in Nginx I have the following site configuration /etc/nginx/sites-enabled/datadog 在Nginx中,我具有以下站点配置/etc/nginx/sites-enabled/datadog

server {
  listen 80;
  server_name localhost;

    location ~ ^/(status|ping)$ {
        access_log off;
        allow 127.0.0.1;
        deny all;
        include fastcgi_params;

        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

        fastcgi_pass unix:/run/php/php7.1-fpm.sock;
    }
}

I have tested that the status page is correctly setup using 我已经测试过状态页面已使用正确设置

SCRIPT_NAME=/status \
SCRIPT_FILENAME=/status \
REQUEST_METHOD=GET \
cgi-fcgi -bind -connect /run/php/php7.1-fpm.sock

Which returns 哪个返回

Expires: Thu, 01 Jan 1970 00:00:00 GMT
Cache-Control: no-cache, no-store, must-revalidate, max-age=0
Content-type: text/plain;charset=UTF-8

pool:                 www
process manager:      dynamic
start time:           13/Nov/2017:22:05:44 +0000
start since:          5030
accepted conn:        1789
listen queue:         0
max listen queue:     0
listen queue len:     0
idle processes:       2
active processes:     1
total processes:      3
max active processes: 4
max children reached: 0
slow requests:        0

However, if I try to access the Nginx site using curl http://localhost/status I get the following error. 但是,如果我尝试使用curl http://localhost/status访问Nginx站点,则会出现以下错误。

2017/11/13 23:32:57 [error] 885#885: *35 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1, server: localhost, request: "GET /status HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.1-fpm.sock:", host: "localhost"

您正在引用$document_root但服务器块中没有root指令

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM