connect() failed (111: Connection refused) while connecting to upstream

  • I'm about to die searching for solution ... 😞
    My site is showing error, try open it and you can see it,
    NGINX error log is showing
    connect() failed (111: Connection refused) while connecting to upstream

    I tried :

    • list itemTCP /IP connection in www.conf and vHosts files

    • I tried php5-fpm.sock but this too failed.

    What to do now ?

  • Global Moderator

    What is your nginx config? What is your NodeBB config? Feel free to remove any private information.

  • I have the same issue, here is what Im using
    Ubuntu 16.04,
    node v6.9.4

    Config files:

    server {
        listen 80;
        listen [::]:80;
        location / {
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_set_header Host $http_host;
            proxy_set_header X-NginX-Proxy true;
            proxy_pass http://localhost:4567;
            proxy_redirect off;
            # Socket.IO Support
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";

    For Config file im using

        "url": "http://localhost:4567",
        "secret": "7ab49b85-e...",
        "database": "redis",
        "redis": {
                "host": "",
                "port": "6379",
                "password": "...",
                "database": "1"

    Also when I start it using node app.js, one of the lines says:

     14/3 15:11:55 [12013] - info: [] Restricting access to origin: http://localhost:*

    Error i getting

    2017/03/14 15:18:19 [error] 1416#1416: *89 connect() failed (111: Connection refused) while connecting to upstream, client:, server:, request: "GET / HTTP/1.1", upstream: "http://[::1]:4567/", host: "", referrer: ""

    Any ideas?

  • Global Moderator

    @Mike-Z change the url in your config file to the actual url of your forum.

  • Thanks for the reply, I spend few hours looking into it, and the solutions was this simple. Thanks.

Log in to reply


Looks like your connection to NodeBB was lost, please wait while we try to reconnect.