错误上游超时。我的设置有什么问题?

时间:2014-08-07 08:47:41

标签: php wordpress nginx

我在2GB ram / 2x CPU digitalocean vps上使用nginx和php5-fpm在debian 7 x64下的tcp / ip 127.0.0.1:9000上运行wordpress 3.9.1。我正在经历大量的504网关超时。     nginx日志输出是:     上行超时(110:连接超时),同时连接到上游或     上游超时(110:连接超时),同时从上游读取响应头

www.conf:
listen = 127.0.0.1:9000
pm = dynamic
pm.max_children = 25
pm.start_servers = 4
pm.min_spare_servers = 4
pm.max_spare_servers = 8
pm.max_requests = 200
listen_backlog = 65536
request_terminate_timeout = 30

php.ini:
max_execution_time = 30

nginx.conf:
worker_processes 2;
worker_connections 1024;
client_max_body_size 10M;
fastcgi_read_timeout 30s;
client_header_timeout 30s;
client_body_timeout 30s;
fastcgi_send_timeout 30s;    
fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k;
keepalive_timeout 65;
gzip on;

The recommended settings of DO for the sysctl.conf are:    
# Digital Ocean Recommended Settings:
net.core.wmem_max=12582912
net.core.rmem_max=12582912
net.ipv4.tcp_rmem= 10240 87380 12582912
net.ipv4.tcp_wmem= 10240 87380 12582912

the following was removed completely:
php5-fpm.conf (/etc/nginx/conf.d/):
upstream php5-fpm-sock { 
server unix:/var/run/php5-fpm.sock; 
}

我还试图禁用我的插件而没有运气。当wordpress仪表板显示"连接丢失时,网站变得没有响应"消息,最终504网关超时。

有类似经历的人吗? 任何建议,将不胜感激。 感谢。

1 个答案:

答案 0 :(得分:2)

Nginx worker_processes应该直接与CPU线程相关联;因为你有一个2核CPU,那么你应该有2个worker_processes线程。

接下来,尝试将php-fpm服务器增加到x4的CPU线程。类似的东西:

pm.start_servers = 4
pm.min_spare_servers = 4
pm.max_spare_servers = 8

此外,nginx抱怨上游超时。你有任何上游配置/服务器吗?