linux环境网站提示502 Bad Gateway怎么解决

2025-03-16 06:52:08

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

linux环境网站提示502 Bad Gateway怎么解决

工具/原料

linux

解决办法:

1、提升服务器的文件句柄打开打开vi /etc/security/limits.conf 底部加上* soft nofile 51200* hard nofile 51200vi /etc/sys艘早祓胂ctl.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 查看

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢