linux nginx 网站访问提示502 Bad Gateway

linux nginx 网站访问提示502 Bad Gateway

nginx日志查看很多connect() failed (111: Connection refused) while connecting to upstream 报错,
然后查看php fpm_children_bury(), line 215: child 20859 (pool default) exited on signal 15 SIGTERM after 44.328668 seconds from start 较多报错,从网上查到是php线程打开文件句柄受限导致的错误,解决办法:

1、提升服务器的文件句柄打开打开

vi /etc/security/limits.conf 底部加上
* soft nofile 51200
* hard nofile 51200
vi /etc/sysctl.conf  底部添加
fs.file-max=51200

2、提升nginx的进程文件打开数

vi /www/wdlinux/nginx/conf/nginx.conf

worker_rlimit_nofile 5120; 改成worker_rlimit_nofile 51200;

3、修改php-fpm.conf文件,主要需要修改2处。

vi /www/wdlinux/etc/php-fpm.conf
改成下面的值
10240

51200

4.设置php-fpm自动启动

vi /etc/rc.local 最后增加
/etc/init.d/php-fpm start

ulimit -n 查看

完了reboot重启下服务器

暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇