简体   繁体   English

NGINX + NODE JS-连接到上游时没有实时上游,客户端:127.0.0.1

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

I am getting following error in error.log file nginx conf file. 我在error.log文件nginx conf文件中遇到以下错误。

I am trying to run nginx server on to of node js server. 我正在尝试在节点js服务器上运行nginx服务器。

Error : no live upstreams while connecting to upstream, client: 127.0.0.1, server: www.XYZ.com, request: "GET / HTTP/1.0", upstream: " http://localhost/ ", host: "localhost" 错误:连接到上游时没有实时上游,客户端:127.0.0.1,服务器:www.XYZ.com,请求:“ GET / HTTP / 1.0”,上游:“ http:// localhost / ”,主机:“ localhost”

Node js server is running on port 3000 and nginx on port 80 Node js服务器在端口3000上运行,nginx在端口80上运行

nginx conf file is 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;

        }
    }



}

and node js server is running on port 3000 并且节点js服务器在端口3000上运行

    app.listen(3000);

It looks like nginx is trying to connect to node js server on dafault port 80 and not 3000. 看起来nginx试图连接到dafault端口80而不是3000上的node js服务器。
Please help me with the issue. 请帮我解决这个问题。 I have spend lot of time on it but no luck. 我花了很多时间,但没有运气。

Thanks 谢谢

对我来说,我通过将proxy_pass移动到proxy_set_header之后的配置块末尾来修复它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 nginx + node.js =通过iframely连接到上游时失败 - nginx + node.js = failed while connecting to upstream with iframely 在Docker容器内连接到Node.js上游时,Nginx连接被拒绝 - Nginx connection refused while connecting to Node.js upstream inside a Docker container 代理到 Node/Express 上游时不常见的 NGINX 错误/超时(连接到上游时上游超时) - Infrequent NGINX Errors/Timeouts when proxying to a Node/Express upstream (upstream timed out while connecting to upstream) 安全网址不适用于Nginx + Node - secure url not working with nginx+node 文件在 node.js 中上传为 nginx 上游 - File uploads in node.js as nginx upstream 连接到上游时,nginx&nodejs:connect()失败(111:连接被拒绝) - nginx & nodejs: connect() failed (111: Connection refused) while connecting to upstream 连接到上游时出错。 Docker 组合、NodeJS、Nginx - error while connecting to upstream. Docker compose, NodeJS, Nginx 连接被拒绝,同时在 engintron/nginx 部署上连接到上游 - Connection refused, while connecting to upstream on engintron/nginx deployment Nginx 有时“连接()失败(111:连接被拒绝)同时连接到上游” - Nginx sometime “connect() failed (111: Connection refused) while connecting to upstream” 在实时服务器上使用 Node Js 连接到 MySQL - Connecting to MySQL with Node Js on a Live Server
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM