您的位置:首页 > 运维架构 > Linux

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

2014-06-11 23:45 495 查看

网站访问提示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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: