Node.JS& nginx每5-20个请求缓慢

时间:2017-03-07 16:40:20

标签: node.js nginx

我在ubuntu 16服务器上安装了Node.Js,nginx。

一切正常,但有时当我请求我的服务时,请求需要1分钟。

有人可以看到我做错了吗?

server {
    listen 443 ssl;
    ssl_certificate /etc/letsencrypt/live/domain/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/domain/privkey.pem;

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers ECDHE-RSA-AES256-SHA384:AES256-SHA256:RC4:HIGH:!MD5:!aNULL:!eNULL:!NULL:!DH:!EDH:!AESGCM;
    ssl_prefer_server_ciphers on;
    ssl_session_cache shared:SSL:10m;
    ssl_session_timeout 10m;
    server_name domain;

    location / {
        proxy_pass http://my-nat-ip:4000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
        proxy_connect_timeout       300;
        proxy_send_timeout          300;
        proxy_read_timeout          300;
        send_timeout                300;
        proxy_buffers           32 4m;
        proxy_busy_buffers_size     25m;
        proxy_buffer_size 512k;
        proxy_ignore_headers "Cache-Control" "Expires";
        proxy_max_temp_file_size 0;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        client_max_body_size        1024m;
        client_body_buffer_size     4m;
        proxy_intercept_errors off;
        proxy_buffering off;
    }
}

1 个答案:

答案 0 :(得分:0)

您的节点代码存在问题。

不幸的是你没有把它包括在内,因此不可能告诉你在哪里。