Website can't be reached: ERR_CONNECTION_REFUSED

Posted October 5, 2020 3.1k views
NginxDNSUbuntu 18.04HTML


I recently bought a domain of namecheap, I followed this guide to setup the DNS to point to my droplet.
I’ve also added the domain to my droplet following this other guide.
I then installed nginx to try and get a basic website running, however I am unable to connect to the website using the domain name (, google chrome show me the “This site can’t be reached” page with the error “ERRCONNECTIONREFUSED”.
I tried using the IP of my droplet and I can access the website, I also tried to use curl -4 and the response I get is the html code of the index.
I can’t seem to find anyone else with the exact same problem and I’m a stuck in this situation as I’m new to hosting websites and using domain names, if anyone has a solution please let me know.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

Hi there @Powasystem,

It looks like that your website is working as expected over http but not over https. At the moment as you have a redirect from http to https this is why the site is not loading in Chrome.

To get that fixed, I would recommend installing a Let’s Encrypt SSL certificate as described in this tutorial here:

Once the SSL has been installed, make sure to open port 443 as well.

Hope that this helps!

by Brian Boucheron
Let's Encrypt is a Certificate Authority (CA) that provides an easy way to obtain and install free TLS/SSL certificates, thereby enabling encrypted HTTPS on web servers. It simplifies the process by providing a software client, Certbot, that attempts to automate most (if not all) of the required steps. In this tutorial, you will use Certbot to obtain a free SSL certificate for Nginx on Ubuntu 20.04, and set up your certificate to renew automatically.