doudula1974 2018-09-02 12:51
浏览 71

cPanel Nginx + PHP FastCGI因502 Bad Gateway而崩溃

I have a cPanel/WHM server with nginx and FastCGI.

When i'm loading a script that takes like 3 minutes to execute, the 502 Bad Gateway appears for all users for 1/2 seconds and disappear.

I have changed the proxy's timeout to 300, php.ini's execution time to 300 and fastcgi's timeout to 300.

But that doesn't fix the issue...

In my logs, i have that:

2018/09/02 10:53:30 [error] 18290#18290: *1737 upstream prematurely closed connection while reading response header from upstream, client: x.xx.xxx.xxx, server: xxxxx.fr, request: "GET / HTTP/1.1", upstream: "https://xx.xxx.xxx.xxx:8443/", host: "xxxxxxx.fr"

here is my config:

http {
## Basic Settings ##
client_body_buffer_size        128k;
client_body_timeout            300s; # Use 5s for high-traffic sites
client_header_timeout          300s; # Use 5s for high-traffic sites
client_max_body_size           1024m;
keepalive_timeout              30s;
open_file_cache                max=200000 inactive=20s;
open_file_cache_errors         on;
open_file_cache_min_uses       2;
open_file_cache_valid          30s;
port_in_redirect               off;
reset_timedout_connection      on;
send_timeout                   300s;
sendfile                       on;
server_name_in_redirect        off;
server_names_hash_bucket_size  1024;
server_names_hash_max_size     1024;
server_tokens                  off;
tcp_nodelay                    on;
tcp_nopush                     on;
types_hash_max_size            2048;
fastcgi_buffers 256 16k;
fastcgi_buffer_size 32k;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;

And here is the proxy's config

# General Proxy Settings
proxy_pass                    $PROXY_SCHEME://$PROXY_DOMAIN_OR_IP:$PROXY_TO_PORT;
proxy_hide_header             Upgrade;
proxy_http_version            1.1;                # Always upgrade to HTTP/1.1
proxy_set_header              Accept-Encoding ""; # Optimize encoding
proxy_set_header              Connection "";      # Enable keepalives
proxy_set_header              Host $host;
proxy_set_header              Proxy "";
proxy_set_header              Referer $http_referer;
proxy_set_header              X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header              X-Forwarded-Host $PROXY_FORWARDED_HOST;
proxy_set_header              X-Forwarded-Port $server_port;
proxy_set_header              X-Forwarded-Proto $scheme;
proxy_set_header              X-Forwarded-Server $host;
proxy_set_header              X-Real-IP $remote_addr;
proxy_set_header              CF-Connecting-IP $http_cf_connecting_ip;
proxy_set_header              CF-Visitor $http_cf_visitor;

# Buffers
proxy_buffers                 256 16k;
proxy_buffer_size             128k;
proxy_busy_buffers_size       256k;
proxy_temp_file_write_size    256k;

# Timeouts
proxy_connect_timeout         300s;
proxy_read_timeout            300s;
proxy_send_timeout            300s;

If someone can help me... Thanks

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 运筹学排序问题中的在线排序
    • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
    • ¥30 求一段fortran代码用IVF编译运行的结果
    • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
    • ¥15 C++ 头文件/宏冲突问题解决
    • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
    • ¥50 安卓adb backup备份子用户应用数据失败
    • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
    • ¥30 python代码,帮调试,帮帮忙吧
    • ¥15 #MATLAB仿真#车辆换道路径规划