我使用 php-fpm 和 nginx,我正在运行一个很慢的脚本,但它阻止了所有的 Cloudflare 连接,很可能是 php-fpm 问题,但我无法通过 Google 找到任何东西。
如果我运行 php 脚本 (sleep(10)),它将阻止所有其他页面,直到脚本完成为止。但是,我直接访问服务器,不会遇到此问题。
有任何想法吗?
php-fpm 配置:
pm = dynamic
pm.max_children = 50000
pm.start_servers = 120
pm.min_spare_servers = 90
pm.max_spare_servers = 180
pm.max_requests = 5000
request_slowlog_timeout = 60s
slowlog = /var/log/php-fpm/www-slow.log
catch_workers_output = yes
nginx配置:
user nginx;
worker_processes 12;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 19000;
}
worker_rlimit_nofile 20000;
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
server_tokens off;
access_log off;
etag off;
sendfile on;
keepalive_timeout 65;
gzip on;
gzip_vary on;
gzip_comp_level 9;
gzip_disable "msie6";
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/javascript text/xml application/xml application/rss+xml application/atom+xml application/rdf+xml;
include /etc/nginx/conf.d/*.conf;
}
答案1
我真傻,是会话处理程序导致了这个问题。
专业提示,不要在 3 层包含内自动会话!