![奇怪的 Nginx 问题](https://linux22.com/image/630485/%E5%A5%87%E6%80%AA%E7%9A%84%20Nginx%20%E9%97%AE%E9%A2%98.png)
我们的服务器遇到了一个奇怪的问题。我们的服务器有 1GB RAM,一些 drupal 网站正在其上运行。
通常情况下,所有网站都可以正常加载,但有时我们无法访问任何网站。等待 10 分钟后,我们收到 502 网关超时错误。在中间,当我们重新启动 nginx 或 php5-fpm 时,它将加载。
我们的配置如下:
/etc/nginx/nginx.conf:
user www-data;
worker_processes 1;
pid /run/nginx.pid;
worker_rlimit_nofile 400000;
events {
worker_connections 10000;
multi_accept on;
use epoll;
}
http {
access_log off;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 2;
types_hash_max_size 2048;
server_tokens off;
keepalive_requests 100000;
reset_timedout_connection on;
port_in_redirect off;
client_max_body_size 10m;
proxy_connect_timeout 600s;
proxy_send_timeout 600s;
proxy_read_timeout 600s;
fastcgi_send_timeout 600s;
fastcgi_read_timeout 600s;
open_file_cache max=200000 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 2;
open_file_cache_errors on;
/etc/php5/fpm/pool.d/www.conf
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
;pm.process_idle_timeout = 10s;
;pm.max_requests = 200
request_terminate_timeout = 300s
请查看/etc/sysctl.conf中添加的内容
fs.file-max = 150000
net.core.netdev_max_backlog=32768
net.core.optmem_max=20480
#net.core.rmem_default=65536
#net.core.rmem_max=16777216
net.core.somaxconn=50000
#net.core.wmem_default=65536
#net.core.wmem_max=16777216
net.ipv4.tcp_fin_timeout=120
#net.ipv4.tcp_keepalive_intvl=30
#net.ipv4.tcp_keepalive_probes=3
#net.ipv4.tcp_keepalive_time=120
net.ipv4.tcp_max_orphans=262144
net.ipv4.tcp_max_syn_backlog=524288
net.ipv4.tcp_max_tw_buckets=524288
#net.ipv4.tcp_mem=1048576 1048576 2097152
#net.ipv4.tcp_no_metrics_save=1
net.ipv4.tcp_orphan_retries=0
#net.ipv4.tcp_rmem=4096 16384 16777216
#net.ipv4.tcp_synack_retries=2
net.ipv4.tcp_syncookies=1
#net.ipv4.tcp_syn_retries=2
#net.ipv4.tcp_wmem=4096 32768 16777216
获取日志条目时没有错误。有人能帮我们解决吗?
谢谢