NGINX、PHP5-FPM、Varnish。一段时间后,WP-Admin 变得无响应

NGINX、PHP5-FPM、Varnish。一段时间后,WP-Admin 变得无响应

大约 10 小时未登录后,wp-admin 变得无响应。为了使其正常工作,我需要重新启动 php5-fpm。

我正在使用带有 PHP5-FPM 和 Varnish 的 NGINX。

这是我的设置:

php5-fpm.conf

pid = /run/php5-fpm.pid
error_log = /var/log/php5-fpm.log
log_level = debug
events.mechanism = epoll

include=/etc/php5/fpm/pool.d/*.conf

pool.d/www.conf

[www]

user = www-data
group = www-data

listen = /var/run/php5-fpm.sock1
listen.owner = www-data
listen.group = www-data

pm = dynamic
pm.max_children = 20
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
pm.max_requests = 1000

chdir = /

NGINX

user  www-data;
worker_processes  4;

error_log /var/log/nginx/error.log warn;
worker_rlimit_nofile 40960;

events {
    worker_connections   1024;
    use epoll;
    multi_accept on;
}

http {
include mime.types;

upstream php {
    server unix:/var/run/php5-fpm.sock1;
}


server {
                add_header Access-Control-Allow-Origin *;
        server_name www.example.com;
        root /var/www/html;
        index index.php;
                listen 8080;
        location = /favicon.ico {
                log_not_found off;
                access_log off;
        }

        location = /robots.txt {
                allow all;
                log_not_found off;
                access_log off;
        }

        location / {
                try_files $uri $uri/ /index.php?$args;
        }

        location ~ \.php$ {
                include fastcgi.conf;
                fastcgi_intercept_errors on;
                fastcgi_pass php;
        }

        location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
                expires max;
                log_not_found off;
        }
}

答案1

将 PHP-FPM 设置为按需,你可能已经达到工作进程的上限

相关内容