php 502.88,Nginx+PHP-FPM 访问出现 502错误
游戲后端代碼采用Nginx+PHP-FPM的方式部署。放問游戲的時候偶爾會出現502錯誤。
Nginx錯誤日志出現以下日志
2014/07/05 17:20:58 [error] 18431#0: *148739 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 192.168.1.56, server: , request: "POST /gateway.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: ""
現列出排查思路
1.
在/etc/php.ini中設置PHP腳本執行的最長時間max_execution_time = 30,這里設置為30秒。
2.
在/etc/php-fpm.conf 中設置PHP-FPM進程處理每個進程的超時時間request_terminate_timeout = 30s
3.
在/etc/php-fpm.conf中開啟PHP的慢日志
request_slowlog_timeout = 1s
slowlog = /var/log/php-fpm/www-slow.log
4.
在Nginx配置文件nginx.conf 中設置
fastcgi_connect_timeout 60; 設置Nginx和FastCGI Server建立連接的超時時間,默認是60秒,但是這個值不能經常超過75秒
fastcgi_send_timeout 60;? ? 設置Nginx傳送請求到FastCGI Server的超時時間
fastcgi_read_timeout 60;? ? 設置FastCGI Server讀取請求的超時時間
Nginx 的詳細介紹:請點這里
Nginx 的下載地址:請點這里
與50位技術專家面對面20年技術見證,附贈技術全景圖總結
以上是生活随笔為你收集整理的php 502.88,Nginx+PHP-FPM 访问出现 502错误的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 信用卡逾期能贷款吗
- 下一篇: html文件怎么改为php,请问你们怎么