Home  >  Article  >  Backend Development  >  php-fpm总是挂

php-fpm总是挂

WBOY
WBOYOriginal
2016-06-13 11:15:51728browse

php-fpm老是挂
新做的一个项目 切换到线上的一个域名(访问量有点大) 就出现502 了。

日志是 类似

[error] 3169#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET /index.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "127.0.0.1"

貌似fpm根本没启动一样的。。

之前调试sql(把sql输出在header中,数据比较多时容易出现502)。现在把一些header输出都关闭了。访问量大了也挂。
换个域名,没什么访问量就没什么问题。这种情况一般是什么造成的。求大神!


------解决方案--------------------
把nginx的worker_rlimit_nofile设置成与系统ulimit -n的值一样。

另外把php-fpm.conf的rlimit_files参数也设置成与ulimit -n的值一致。再根据服务器能力,调调那些跟进程相关的参数。

就不容易出现502了。
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn