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,問題解決

相關文章
相關標籤/搜索