130 字
1 分钟
linux nginx 网站访问提示502 Bad Gateway
2014-02-24
无标签
浏览量:加载中...访问次数:加载中...

从日志报错分析,是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
    完成之后reboot重启下服务器
    ulimit -n 查看
linux nginx 网站访问提示502 Bad Gateway
https://blog.057000.xyz/posts/2014-02-24-linux-nginx-网站访问提示502-bad-gateway/
作者
Feng
发布于
2014-02-24
许可协议
CC BY-NC-SA 4.0