Node.js NGINX+;节点JS-连接到上游时没有实时上游,客户端:127.0.0.1

Node.js NGINX+;节点JS-连接到上游时没有实时上游,客户端:127.0.0.1,node.js,nginx,Node.js,Nginx,我在error.log文件nginx conf文件中遇到以下错误 我正在尝试在js服务器的节点上运行nginx服务器 错误:连接到上游时没有实时上游,客户端: 127.0.0.1,服务器:www.XYZ.com,请求:“GET/HTTP/1.0”,上游:,主机:“localhost” 节点js服务器在端口3000上运行,nginx在端口80上运行 nginx conf文件是 http { include mime.types; default_type applic

我在error.log文件nginx conf文件中遇到以下错误

我正在尝试在js服务器的节点上运行nginx服务器

错误:连接到上游时没有实时上游,客户端: 127.0.0.1,服务器:www.XYZ.com,请求:“GET/HTTP/1.0”,上游:,主机:“localhost”

节点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服务器。
请帮我解决这个问题。我花了很多时间在这上面,但运气不好


感谢我,我通过在代理设置头之后将代理传递到配置块的末尾来修复它。

对于我,我通过在代理设置头之后将代理传递到配置块的末尾来修复它。

我想这是因为您的节点服务器没有及时启动。您可以添加“代理读取超时”吗在nginx文件中,请运行
nginx-T
,并确保没有获得其他配置。我尝试了这两个选项,但仍然收到错误:上游超时(10060:连接尝试失败,因为连接方在一段时间后没有正确响应,或者建立的连接失败,因为连接的主机没有响应)连接到上游时,客户端:127.0.0.1,服务器:www.XYZ.com,请求:“GET/HTTP/1.0”,上游:“HTTP://[::1]:80/”,主机:“localhost”将
nginx-T
sudo netstat-plant
的输出添加到你的问题中我想这是因为你的节点服务器没有及时启动,你能在nginx文件中添加'proxy\u read\u timeout 5m;'吗请运行
nginx-T
并确保你没有获得其他配置,我尝试了这两个选项,但仍然出错:上游连接到上游时超时(10060:连接尝试失败,因为连接方在一段时间后没有正确响应,或者建立的连接失败,因为连接的主机没有响应),客户端:127.0.0.1,服务器:www.XYZ.com,请求:“GET/HTTP/1.0”,上游:“HTTP://[::1]:80/”,主机:“localhost”将
nginx-T
sudo netstat-plant
的输出添加到您的问题中