簡體   English   中英

NGINX + NODE JS-連接到上游時沒有實時上游,客戶端:127.0.0.1

[英]NGINX+NODE JS - no live upstreams while connecting to upstream, client: 127.0.0.1

我在error.log文件nginx conf文件中遇到以下錯誤。

我正在嘗試在節點js服務器上運行nginx服務器。

錯誤:連接到上游時沒有實時上游,客戶端:127.0.0.1,服務器:www.XYZ.com,請求:“ GET / HTTP / 1.0”,上游:“ http:// localhost / ”,主機:“ localhost”

Node js服務器在端口3000上運行,nginx在端口80上運行

nginx conf文件是

http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  128;

    #gzip  on;
    server_names_hash_bucket_size 64;
    client_header_timeout 3000;
    client_body_timeout 3000;
    fastcgi_read_timeout 3000;
    client_max_body_size 32m;
    fastcgi_buffers 8 128k;
    fastcgi_buffer_size 128k; 


    server {
        listen 80 ;
        server_name XYZ.com;
        location / {
         # Base url of the Data Science Studio installation
        proxy_pass http://localhost:3000;
        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;

        }
    }



}

並且節點js服務器在端口3000上運行

    app.listen(3000);

看起來nginx試圖連接到dafault端口80而不是3000上的node js服務器。
請幫我解決這個問題。 我花了很多時間,但沒有運氣。

謝謝

對我來說,我通過將proxy_pass移動到proxy_set_header之后的配置塊末尾來修復它。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM