分享在linux环境下网站提示502 Bad Gateway的解决方法

来源:互联网 发布:蚕丝毛毯 知乎 编辑:程序博客网 时间:2024/05/22 13:26


网站访问提示502 Bad Gateway怎么解决?根据分析一般是php线程打开文件句柄受限导致的。

分享在linux环境下网站提示502 Bad Gateway的解决方法


1、提升服务器的文件句柄打开打开vi /etc/security/limits.conf 底部加上* soft nofile 51200* hard nofile 51200vi /etc/sysctl.conf  底部添加fs.file-max=51200

2、提升nginx的进程文件打开数vi /www/wdlinux/nginx/conf/nginx.confworker_rlimit_nofile 5120; 改成worker_rlimit_nofile 51200;

3、修改php-fpm.conf文件,主要需要修改2处。vi /www/wdlinux/etc/php-fpm.conf改成下面的值<value name="max_requests">10240</value><value name="rlimit_files">51200</value>

4、设置php-fpm自动启动vi /etc/rc.local 最后增加/etc/init.d/php-fpm start

5、完成之后reboot重启下服务器ulimit -n 查看


原文参考资源共享网:www.5azyw.com/thread-1296-1-1.html

0 0
原创粉丝点击