ERR_CONNECTION_REFUSED is one of the most common connection errors users and website owners face. It indicates that the browser was unable to establish a connection to the server: the request was sent, the IP address was resolved, but the server refused to accept the connection.
What ERR_CONNECTION_REFUSED Actually Means
When you open a website, the browser performs the following:
- Resolves the domain name to an IP address (DNS query);
- Sends an HTTP/HTTPS request to the resolved IP and port (usually 80 or 443);
- Awaits a response from the server.
If the server actively rejects the connection attempt, the browser returns the following error:
This is not a DNS or timeout error — it’s a direct refusal to connect, triggered by specific conditions.
Step-by-Step Solutions to ERR_CONNECTION_REFUSED
1. Test Internet Connectivity and Site Availability
Start by verifying that your internet connection is working correctly. Attempt to access the website using a different browser or device.
2. Flush the DNS Cache
Outdated or corrupted DNS cache can cause failed connections. Clear it using the following commands:
- Windows:
ipconfig /flushdns
- macOS:
sudo dscacheutil - flushcache; sudo killall -HUP mDNSResponder
- Linux:
sudo systemd-resolve -flush-caches
3. Update Your DNS Settings
Incorrect or slow DNS servers can block or misroute requests. Set your DNS manually to trusted providers:
- Google DNS: 8.8.8.8 and 8.8.4.4
- Cloudflare DNS: 1.1.1.1 and 1.0.0.1
Change these in your network adapter settings or router configuration panel.
4. Disable VPN, Proxy, and Security Software
VPN services, proxy configurations, and firewall/antivirus software can interfere with traffic routing or block connections:
- Turn off any active VPN or proxy;
- Temporarily disable antivirus and firewall protection;
- Relaunch the browser in incognito/private mode with extensions disabled.
5. Clear the Browser Cache
Corrupted cookies or cached data may cause access issues. In Chrome, go to:
Settings → Privacy → Clear browsing data
Select “Cached files” and “Cookies”, then clear and restart the browser.
6. Check HTTP/HTTPS Port Access
If you’re operating a website or server, ensure that ports 80 (HTTP) and 443 (HTTPS) are open and not blocked by firewall settings. Use the following UFW commands if applicable:
sudo ufw allow 80 sudo ufw allow 443
Ensure the changes are applied by reloading the firewall configuration.
7. Verify Web Server Status
Ensure the web server is up and running:
sudo systemctl status nginx sudo systemctl status apache2
If the service is inactive, restart it:
sudo systemctl restart nginx
8. Test the SSL Certificate
An expired, misconfigured, or missing SSL certificate can also result in a refused connection. Use this command to test:
openssl s_client -connect yourdomain.com:443
9. Review Server Error Logs
If server access is available, logs can reveal exact reasons for refused connections:
- For Nginx: /var/log/nginx/error.log
- For Apache: /var/log/apache2/error.log
Check for issues related to configuration, blocked IPs, or service errors.


