【问题标题】:Plesk 11.5 php-fpm.sock failed - resource temporarily unavailable & 502 Bad Gateway NGINX errorsPlesk 11.5 php-fpm.sock 失败 - 资源暂时不可用 & 502 Bad Gateway NGINX 错误
【发布时间】:2013-08-18 06:45:21
【问题描述】:

此问题出现在使用 Plesk 11.5 并启用 NGINX 和 PHP-FPM 处理的网站上。

php-fpm.sock 失败(11:资源暂时不可用

网站还会显示以下消息:“502 Bad Gateway”NGINX

与该网站的所有连接都将失败,因为 PHP-FPM 将不再允许与该特定网站的任何连接。我能想出的唯一解决方案是重新启动 PHP-FPM(服务 php-fpm 重新启动)。这会持续一段时间,直到 PHP-FPM 缓冲区填满。我曾尝试更改域特定 php-fpm 设置中的最大连接数,但这似乎不起作用。

要注意的另一件有趣的事情是,该特定域位于具有 30 个其他域的服务器上。然而,当错误发生时,该域是唯一有问题的域。使用 PHP-FPM 进行 PHP 处理的所有其他网站继续正常工作。

PHP-FPM.CONF

include=/etc/php-fpm.d/*.conf
pid = /var/run/php-fpm/php-fpm.pid
error_log = /var/log/php-fpm/error.log
;log_level = notice
emergency_restart_threshold = 10
emergency_restart_interval = 1m
process_control_timeout = 10s
;daemonize = yes

PHP-FPM 域配置(来自 php-fpm.d 文件夹)

listen = php-fpm.sock
listen.owner = root
listen.group = psaserv
listen.mode = 0660

; Following options can be overridden
chdir = /
pm = ondemand
pm.max_children = 25
pm.process_idle_timeout = 10s
pm.start_servers = 3
pm.min_spare_servers = 3
pm.max_spare_servers = 5

NGINX.CONF

#user  nginx;
worker_processes  4;
events {
    worker_connections  2048;
}
http {
    include   mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  /var/log/nginx/access.log  main;

    sendfile        on;
    tcp_nopush     on;

        send_timeout 60;
        proxy_read_timeout 60;
        proxy_connect_timeout 60;

    #keepalive_timeout  0;
    keepalive_timeout  4;

fastcgi_connect_timeout 60;
fastcgi_send_timeout 180;
fastcgi_read_timeout 180;
fastcgi_buffer_size 128k;
fastcgi_buffers 256 16k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
fastcgi_intercept_errors on;


    gzip  on;
    #gzip_disable "MSIE [1-6]\.(?!.*SV1)";

    server_tokens off;

    include /etc/nginx/conf.d/*.conf;
}

特定领域的 NGINX.conf

(跳过一堆服务器/ssl/域特定参数。这两个可能很重要)。

client_max_body_size 128m;
proxy_read_timeout 10;

【问题讨论】:

  • 请显示 PHP-FPM 域配置。
  • 能否请您提供php和php-fpm版本?
  • 这是完整的错误消息“资源暂时不可用”?我搜索了一下,发现它看起来不像完整的错误字符串。

标签: nginx plesk php


【解决方案1】:

只是为了尝试本地化问题:

  1. 将 pm = ondemand 切换为 pm = dynamic
  2. 将 pm.start_servers 和 pm.min_spare_servers 增加到 4
  3. 添加 pm.max_requests = 500
  4. 添加 pm.status_path - 阅读文档它是什么以及如何使用它。
  5. 重启php-fpm服务

观察一会儿。

这些更改可能会被 plesk 覆盖,因此请注意。

【讨论】:

  • 感谢您迄今为止的帮助。我已经尝试了许多更改,并且我经常尝试它们。这里还有其他一些具有类似主题的帖子,但不是针对 Plesk。非常奇怪的是,这种 PHP-FPM 挂断似乎只发生在服务器上的单个域中。其余的都没有这个问题。每当我重新启动 php-fpm 服务时,都会有许多正在运行的 PHP-FPM 进程,全部由该域用户执行。就好像他们都被卡住了,没有清理干净。我已经包含了我所有的配置以供参考。
  • 也许 1. 在此域上使用的 PHP 代码/应用程序中有一些特殊之处 2. 域上的负载高于其他域。 3.自定义“php设置”? 4.自定义“Web服务器设置”?
猜你喜欢
  • 1970-01-01
  • 2018-04-23
  • 2019-09-15
  • 2019-03-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-05-23
  • 2018-11-12
相关资源
最近更新 更多