即使在Nginx.confNode.js中增加了超时之后,网关仍返回504

问题描述

这是我的Nginx配置

server {
    listen 4000 ssl;
    ssl_certificate /opt/certs/test.crt;
    ssl_certificate_key /opt/certs/test.key;
    ssl_protocols TLSv1.2;
    ssl_ciphers 'sample';
    ssl_prefer_server_ciphers on;
    ssl_session_cache shared:SSL:10m;
    ssl_session_timeout 10m;
    large_client_header_buffers 4 64k;
    client_header_buffer_size 16k;
    add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
    add_header "Cache-Control" "max-age=0,no-cache,no-store,must-revalidate";
    add_header "Pragma" "no-cache";
    add_header X-Content-Type-Options nosniff;
    add_header X-XSS-Protection "1; mode=block";
    add_header Content-Security-Policy "script-src 'unsafe-inline'";

    
    location / {
        proxy_pass https://127.0.0.1:4001;
        proxy_set_header Host $http_host;
        proxy_read_timeout 600s;
        proxy_http_version 1.1;
    }
}

server {
   
    listen 4400 ssl;
    ssl_certificate /opt/certs/sample.crt;
    ssl_certificate_key /opt/certs/sample.key;
    ssl_protocols TLSv1.2;
    ssl_ciphers 'sample';
    ssl_prefer_server_ciphers on;
    ssl_session_cache shared:SSL:10m;
    ssl_session_timeout 10m;
    large_client_header_buffers 4 64k;
    client_header_buffer_size 16k;
    add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
    add_header "Cache-Control" "max-age=0,must-revalidate";
    add_header "Pragma" "no-cache";
    add_header X-Content-Type-Options nosniff;
    add_header X-XSS-Protection "1; mode=block";
    add_header Content-Security-Policy "script-src 'unsafe-inline'";

    ssl_verify_client off;
    

    location / {
        proxy_pass https://127.0.0.1:4001;
        proxy_set_header Host $http_host;
        proxy_read_timeout 600s;
        proxy_http_version 1.1;
    }
}

}

该服务一直等待到超时,但是当通过网关命中时,它恰好在60秒后超时。 我试过设置send_timeout,keepalive_timeout等选项,但是没有任何效果。 有人可以告诉我Nginx.conf或NodeJS的任何设置中缺少的内容吗 谢谢。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)