【问题标题】:PHP-FPM status page on Plesk + NGINX proxyPlesk + NGINX 代理上的 PHP-FPM 状态页面
【发布时间】:2017-07-30 16:13:40
【问题描述】:

我正在尝试在 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;
}

但是,这个(以及我也尝试过的其他一些指令)似乎不起作用,因为我在访问状态页面时收到“找不到文件”错误。

有人能做到吗?

谢谢!

【问题讨论】:

    标签: php apache nginx proxy plesk


    【解决方案1】:

    以下对我在 CentOS 7 上使用 PLESK 17 有效(在 Plesk > 网站与域 > [yourdomainname] > 托管设置 我有:运行 PHP 作为 由 nginx 提供服务的 FPM 应用程序)

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

    1. 创建/编辑/var/www/vhosts/system/[yourdomainname]/conf/php.ini添加以下内容

      [php-fpm-pool-settings]
      pm.status_path = /status
      
    2. Plesk > 网站与域名> [yourdomainname] > Apache & nginx 设置 中添加Additional 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]/statushttp://[yourdomainname]/status?full

    【讨论】:

      【解决方案2】:

      状态页面需要 80/443 端口用于 apache2,但结合 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

      【讨论】:

      • 不幸的是,您的解决方案适用于 apache 状态页面(我已经启用),而不适用于 PHP-FPM 状态页面。
      • 我根据之前的建议为您编辑。请。报告您的测试结果。 :-)
      • 我取得了部分成功,我可以看到页面,但我得到的只是“找不到文件”。错误。套接字文件在那里,我也和其他人一起检查过......我的日志文件写着"FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream"
      • 您可以通过添加“fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;”来解决这个问题附加指令。请。测试并报告,所以我可以编辑我的上述建议。
      猜你喜欢
      • 2012-01-20
      • 1970-01-01
      • 2020-07-11
      • 2017-11-21
      • 2014-04-24
      • 1970-01-01
      • 2017-01-01
      • 2020-03-04
      • 2013-11-24
      相关资源
      最近更新 更多