PHP-Plesk + NGINX 代理上的 FPM 状态页面

PHP-FPM status page on Plesk + NGINX proxy

我正在尝试在 Plesk 17 下的虚拟主机 运行 上启用 PHP-FPM 状态页面,使用 apache 来提供 PHP 文件,但使用 nginx 作为代理。 我已启用 php 的状态页面,但我在使用 nginx 规则时遇到问题。到目前为止,这是我的其他 nginx 指令

location /fpm-status {
    include fastcgi.conf;
    fastcgi_pass unix:/var/www/vhosts/system/fifthelement.gr/php-fpm.sock;
    access_log off;
    allow all;
}

但是,这个(以及我也尝试过的其他一些指令)似乎不起作用,因为我在访问状态页面时遇到 "File not found" 错误。

有人成功做到了吗?

谢谢!

状态页面需要 apache2 的端口 80/443,但结合 Plesk,您的 apache2 - 网络服务器侦听端口 7080/7081,nginx 侦听端口 80/443。

请问。使用例如

<IfModule mod_status.c>
 Listen 8005
<Location /apache-status>
 SetHandler server-status
 Order deny,allow
 Deny from all
 Allow from 127.0.0.1 ::1
</Location>
 ExtendedStatus On
</IfModule>

在您的 server.conf、httpd.conf 中并从您的 SSH 调用页面 - 命令行,例如 "lynx"

lynx http://localhost:8005/apache-status

对于您的 PHP-FPM - 状态 - 页面,请。找到相应的 "fifthelement.gr.conf"(使用标准 PHP5 的示例 - 来自您域中供应商的处理程序:“/etc/php5/fpm/pool.d/fifthelement.gr.conf” ) 并在里面定义:

pm.status_path = /fpm-status

之后,将您的附加 nginx 指令修改为例如:

location /fpm-status {
 include fastcgi.conf;
 allow 127.0.0.1;
 deny all;
 fastcgi_pass unix:/var/www/vhosts/system/fifthelement.gr/php-fpm.sock;
 access_log off;
 }

... 同样,您可以在示例中使用 "lynx" - 命令:

lynx http://localhost/fpm-status

以下对我在 CentOS 7 上使用 PLESK 17 有效(在 Plesk > 网站与域名 > [您的域名] > 主机设置 我有:运行 PHP 作为 FPM 应用程序由 nginx)

提供服务

获得工作/状态页面的步骤

  1. Create/edit /var/www/vhosts/system/[yourdomainname]/conf/php.ini 添加以下内容

    [php-fpm-pool-settings]
    pm.status_path = /status
    
  2. 内部 Plesk > 网站与域 > [您的域名] > Apache 和 nginx 设置 添加到 其他 nginx 指令以下

    location ~ ^/status$ {
        allow 127.0.0.1;
        allow [yourip];
        deny all;
        fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_pass "unix:///var/www/vhosts/system/[yourdomainname]/php-fpm.sock";
        include /etc/nginx/fastcgi.conf;
    }
    
  3. 重新加载 Plesk PHP 配置

    /usr/local/psa/bin/php_settings -u
    

那么你应该可以访问http://[yourdomainname]/status and http://[yourdomainname]/status?full