首页 > 解决方案 > connect() 到 unix:/home/admin/web/domain.com/nodeapp/app.sock 在连接到上游 NODEJS 时失败(111:连接被拒绝)

问题描述

我有 nginx 和 nodejs 连接到 unix 的问题

connect() to unix:/home/admin/web/domain.com/nodeapp/app.sock failed (111: Connection refused) while connecting to upstream, client: 103.80.82.197, server: domain.com, request: "GET / HTTP/1.1", upstream: "http://unix:/home/admin/web/domain.com/nodeapp/app.sock:/", host: "domain.com"

我的网络 nginx 配置

server {
    listen      103.164.xx.xxx:80;
    server_name domain.com www.domain.com;
    error_log  /var/log/httpd/domains/domain.com.error.log error;

    location / {
        proxy_pass      http://unix:/home/admin/web/domain.com/nodeapp/app.sock:$request_uri;
        location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|htm|html|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz2|7z|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv|m4v|mkv|mov|mpeg|mpg|wmv|exe|iso|dmg|swf)$ {
            root           /home/admin/web/domain.com/nodeapp;
            access_log     /var/log/httpd/domains/domain.com.log combined;
            access_log     /var/log/httpd/domains/domain.com.bytes bytes;
            expires        max;
            try_files      $uri @fallback;
        }
    }

    location /error/ {
        alias   /home/admin/web/domain.com/document_errors/;
    }

    location @fallback {
        proxy_pass      http://unix:/home/admin/web/domain.com/nodeapp/app.sock:/$1;
    }

    location ~ /\.ht    {return 404;}
    location ~ /\.svn/  {return 404;}
    location ~ /\.git/  {return 404;}
    location ~ /\.hg/   {return 404;}
    location ~ /\.bzr/  {return 404;}

    include /home/admin/conf/web/nginx.domain.com.conf*; }

我是我的 ip 和域的传感器:D,服务器是 CentOS 7 并使用 VestaCP。我尝试使用 CHMOD app.sock 解决到 777,但没有解决。谢谢!

标签: node.jsnginxcentos7vestacp

解决方案


推荐阅读