Nayara
By:
Nayara

Help me to fix "ERR_CONNECTION_REFUSED"

February 11, 2016 13.3k views
LEMP Nginx Ubuntu

Help me to fix "ERRCONNECTIONREFUSED"

Hello, help me please!

I power off my droplet to do a Snapshot, but after that my site get:

ERRCONNECTIONREFUSED

I'm using Ubuntu - LEMP - Nginx

4 comments
  • Can you use the digitalocean dashboard to see the power up state, or if it is powered up use the DO console to see what the boot messages show.

  • Hi, the droplet is active powered, and in digital ocean console I get that message:
    Printscreen

    But I don't can enter through console digital ocean because I have private keys configured only in my computer.

    I can login through Putty in my computer and I ran:

    service nginx restart
    

    And I get that fail:

    *Restarting nginx nginx [fail]
    

    Then I ran that command:

    sudo nginx -t
    

    And I get:

    nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
    nginx [emerg] open() "/var/log/nginx/mysitename/access.log" failed (2: No such file or directory)
    nginx: configuration file /etc/nginx/nginx.conf test failed
    
  • @Nayara - Not sure if the lack of the log file is the problem, but you could create an empty file:

    ## assuming you are logged in as root
    touch /var/log/nginx/mysitename/access.log
    

    The intervening directory may not be present if it fails. Create and change ownership and permissions for nginx to use:

    mkdir -p /var/log/nginx/mysitename
    ## chown and then chmod commands here
    

    Edit - forgot to mention about checking your firewall. See if you can access your site while on your server using curl or wget.

  • Oh thank you!!!

    I ran that command and works fine now!

    mkdir -p /var/log/nginx/mysitename/
    touch /var/log/nginx/mysitename/access.log

1 Answer

This question was answered by @gndo:

@Nayara - Not sure if the lack of the log file is the problem, but you could create an empty file:

## assuming you are logged in as root
touch /var/log/nginx/mysitename/access.log

The intervening directory may not be present if it fails. Create and change ownership and permissions for nginx to use:

mkdir -p /var/log/nginx/mysitename
## chown and then chmod commands here

Edit - forgot to mention about checking your firewall. See if you can access your site while on your server using curl or wget.

View the original comment

Have another answer? Share your knowledge.