"ERR_CONNECTION_REFUSED" on your website: what it means and how to fix it

Chrome reached the server's address and the server said no. Nothing is listening on that port, or a firewall is turning the connection away. The domain works. The machine behind it is not taking visitors.

What to do, in order

  1. Check it is not just you. Load the site on your phone with Wi-Fi off. If it loads there, the problem is your computer, a VPN, or an antivirus proxy. Turn those off and try again.
  2. Try both http and https. If http:// loads and https:// is refused, port 443 is closed. The web server is not set up for HTTPS, or the firewall blocks 443.
  3. On a VPS, check the web server is running. sudo systemctl status nginx (or apache2). If it is stopped, sudo nginx -t shows the config error that stopped it. Fix that line, then start it.
  4. Check what is listening. sudo ss -tlnp | grep -E ':80|:443'. No lines means nothing is listening. A line showing 127.0.0.1:80 means the server only accepts visitors from itself. It must listen on 0.0.0.0.
  5. Check the firewall. sudo ufw status. If 80 and 443 are not allowed, run sudo ufw allow 80/tcp and sudo ufw allow 443/tcp. Your cloud provider may have its own firewall panel too.
  6. Check the DNS points at the right machine. dig +short yourdomain.com. If the address is an old server you moved away from, update the A record at your registrar.

Check it yourself

Run curl -sv https://yourdomain.com 2>&1 | head -5. "Connection refused" confirms the port is closed. "Connected to" means the problem is somewhere else.


Want the rest of your site checked after it is back? Run a free 40-point check at tinkeraudit.com.