502 Bad Gateway The proxy server received an invalid response from an upstream server

打开网站一直报错,查看了一下nginx错误日志,发现不少的报错:nginx

2018/12/24 11:02:51 [alert] 20026#20026: *33113943 socket() failed (24: Too many open files) while connecting to upstream, client:socket

查看nginx设置的可打开文件大小网站

1.查看nginx的进程号日志

ps -elf | grep nginx进程

2.根据查出来的进程号查看进程详情it

cat /proc/进程号/limitsio

其中Max open files是1024,修改配置值,在nginx中修改
worker_rlimit_nofile 65535;event

events { 
        worker_connections 65535; 
}stream

在nginx配置文件中加上这几行cli

重启nginx,问题解决

相关文章
相关标签/搜索