{"id":21807,"date":"2026-05-01T10:09:48","date_gmt":"2026-05-01T07:09:48","guid":{"rendered":"https:\/\/sunucun.com.tr\/blog\/fix-err-connection-refused\/"},"modified":"2026-11-06T00:54:42","modified_gmt":"2026-11-05T21:54:42","slug":"fix-err-connection-refused","status":"publish","type":"post","link":"https:\/\/sunucun.com.tr\/blog\/fix-err-connection-refused\/","title":{"rendered":"What Is ERR_CONNECTION_REFUSED (Connection Refused) and How Do You Fix It?"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_89 ez-toc-wrap-center counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<span class=\"ez-toc-title-toggle\"><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/sunucun.com.tr\/blog\/fix-err-connection-refused\/#What_Does_Connection_Refused_Mean\" >What Does Connection Refused Mean?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/sunucun.com.tr\/blog\/fix-err-connection-refused\/#Causes_of_the_ERR_CONNECTION_REFUSED_Error\" >Causes of the ERR_CONNECTION_REFUSED Error<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/sunucun.com.tr\/blog\/fix-err-connection-refused\/#How_to_Fix_ERR_CONNECTION_REFUSED_as_a_Visitor\" >How to Fix ERR_CONNECTION_REFUSED as a Visitor<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/sunucun.com.tr\/blog\/fix-err-connection-refused\/#ERR_CONNECTION_REFUSED_on_localhost\" >ERR_CONNECTION_REFUSED on localhost<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/sunucun.com.tr\/blog\/fix-err-connection-refused\/#How_to_Fix_Connection_Refused_as_a_Server_Administrator\" >How to Fix Connection Refused as a Server Administrator<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/sunucun.com.tr\/blog\/fix-err-connection-refused\/#1_Check_That_the_Service_Is_Running\" >1. Check That the Service Is Running<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/sunucun.com.tr\/blog\/fix-err-connection-refused\/#2_See_Which_Address_and_Port_the_Service_Listens_On\" >2. See Which Address and Port the Service Listens On<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/sunucun.com.tr\/blog\/fix-err-connection-refused\/#3_Check_the_Firewall_Rules\" >3. Check the Firewall Rules<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/sunucun.com.tr\/blog\/fix-err-connection-refused\/#4_Verify_the_DNS_Record\" >4. Verify the DNS Record<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/sunucun.com.tr\/blog\/fix-err-connection-refused\/#%E2%80%9CConnection_Refused%E2%80%9D_in_SSH\" >&#8220;Connection Refused&#8221; in SSH<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/sunucun.com.tr\/blog\/fix-err-connection-refused\/#%E2%80%9CConnection_Refused%E2%80%9D_with_Databases\" >&#8220;Connection Refused&#8221; with Databases<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/sunucun.com.tr\/blog\/fix-err-connection-refused\/#Conclusion\" >Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n\n<p class=\"wp-block-paragraph\"><strong>ERR_CONNECTION_REFUSED<\/strong> is an error showing that your browser reached a server but the server refused the connection request. Chrome then shows &#8220;\u2026 refused to connect&#8221; on the &#8220;This site can&#8217;t be reached&#8221; page together with the code <code>ERR_CONNECTION_REFUSED<\/code>. The same situation appears as a <strong>&#8220;Connection refused&#8221;<\/strong> message in command-line tools, SSH, database connections and apps. In this guide we explain what the error means, what causes it and how to fix it as a visitor, a developer and a server administrator.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_Does_Connection_Refused_Mean\"><\/span>What Does Connection Refused Mean?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n<p class=\"wp-block-paragraph\">When a connection is made, the client sends a connection request to a specific port on the server (such as 80 or 443 for the web, or 22 for SSH). If no service is running on that port to accept the request, or a security rule is set to reject it, the server immediately answers &#8220;no&#8221; with an <strong>RST<\/strong> packet. When the browser receives this answer, it shows ERR_CONNECTION_REFUSED.<\/p>\n\n\n<p class=\"wp-block-paragraph\">This error shows that the server is <em>reachable<\/em> but does not accept you on that port. If no answer comes at all, the error is ERR_CONNECTION_TIMED_OUT; if the connection is cut after it has been established, you see <a href=\"https:\/\/sunucun.com.tr\/blog\/err_connection_reset-en\/\">ERR_CONNECTION_RESET<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Causes_of_the_ERR_CONNECTION_REFUSED_Error\"><\/span>Causes of the ERR_CONNECTION_REFUSED Error<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n<ul class=\"wp-block-list\"><li><strong>The service is not running:<\/strong> The web server (Apache, Nginx, LiteSpeed), application server or database may have stopped or crashed.<\/li><li><strong>Wrong port:<\/strong> The service runs on a different port from the one you are trying to connect to.<\/li><li><strong>The service listens only on the local address:<\/strong> If the application is bound to <code>127.0.0.1<\/code>, it can only be reached from the server itself; requests from outside are refused.<\/li><li><strong>Firewall rejection:<\/strong> A &#8220;reject&#8221; rule on the server or network firewall refuses the connection.<\/li><li><strong>Wrong IP address or old DNS record:<\/strong> The domain may point to a server that no longer hosts the site.<\/li><li><strong>Proxy or security software on the client side:<\/strong> A local proxy that is not working (for example a proxy setting on 127.0.0.1) makes every connection be refused.<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"How_to_Fix_ERR_CONNECTION_REFUSED_as_a_Visitor\"><\/span>How to Fix ERR_CONNECTION_REFUSED as a Visitor<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n<ol class=\"wp-block-list\"><li><strong>Try the site from another network:<\/strong> Open it on your phone over mobile data. If it does not open there either, the problem is on the site; try again later or let the site owner know.<\/li><li><strong>Check the address:<\/strong> If the address contains a port number such as <code>:8080<\/code>, make sure it is correct; try both <code>http:\/\/<\/code> and <code>https:\/\/<\/code>.<\/li><li><strong>Turn off proxy settings:<\/strong> On Windows, if a manual proxy is set under <strong>Settings &gt; Network &amp; Internet &gt; Proxy<\/strong>, turn it off. A proxy that is not working causes this error on every site.<\/li><li><strong>Clear the cache and the DNS cache:<\/strong> Clear browsing data and run <code>ipconfig \/flushdns<\/code> in Command Prompt.<\/li><li><strong>Test VPN and security software:<\/strong> Temporarily turn off the VPN and the antivirus web protection and try again.<\/li><\/ol>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"ERR_CONNECTION_REFUSED_on_localhost\"><\/span>ERR_CONNECTION_REFUSED on localhost<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n<p class=\"wp-block-paragraph\">The case developers see most often is this error on an address such as <code>http:\/\/localhost:3000<\/code>. It means no application on your computer is listening on that port. We explain the concept in our article <a href=\"https:\/\/sunucun.com.tr\/blog\/what-is-localhost\/\">what is localhost<\/a>. Things to check:<\/p>\n\n\n<ul class=\"wp-block-list\"><li>Is the development server (npm, PHP, Python, XAMPP, WAMP and so on) actually running, or did it exit with an error in the terminal?<\/li><li>Which port does the application use? The port in the terminal output and the port in the browser must be the same.<\/li><li>The port may be in use by another program. Check with <code>netstat -ano | findstr :3000<\/code> on Windows, or <code>lsof -i :3000<\/code> on Linux and macOS.<\/li><li>If you use Docker, make sure you published the container port to your computer (for example <code>-p 3000:3000<\/code>) and that the application listens on <code>0.0.0.0<\/code> inside the container.<\/li><li>Try <code>127.0.0.1<\/code> instead of <code>localhost<\/code>; on some systems localhost resolves to the IPv6 address (<code>::1<\/code>), and if the application listens only on IPv4 the connection is refused.<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"How_to_Fix_Connection_Refused_as_a_Server_Administrator\"><\/span>How to Fix Connection Refused as a Server Administrator<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"1_Check_That_the_Service_Is_Running\"><\/span>1. Check That the Service Is Running<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n<pre class=\"wp-block-code\"><code>systemctl status nginx\nsystemctl status apache2     # CentOS\/AlmaLinux: httpd\nsystemctl restart nginx<\/code><\/pre>\n\n\n<p class=\"wp-block-paragraph\">If the service is not running, restart it and check the logs with <code>journalctl -u nginx --since \"1 hour ago\"<\/code> to see why it stopped. If there is a configuration error, <code>nginx -t<\/code> or <code>apachectl configtest<\/code> shows the problem.<\/p>\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"2_See_Which_Address_and_Port_the_Service_Listens_On\"><\/span>2. See Which Address and Port the Service Listens On<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n<pre class=\"wp-block-code\"><code>ss -tlnp<\/code><\/pre>\n\n\n<p class=\"wp-block-paragraph\">Make sure the port in question is listed and that the address is <code>0.0.0.0<\/code> (or the server&#8217;s public IP). A line such as <code>127.0.0.1:3306<\/code> shows that the service accepts only local connections; if outside access is needed, change the bind address in the service&#8217;s configuration.<\/p>\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"3_Check_the_Firewall_Rules\"><\/span>3. Check the Firewall Rules<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n<pre class=\"wp-block-code\"><code>ufw status                  # Ubuntu\/Debian\nfirewall-cmd --list-all     # CentOS\/AlmaLinux\niptables -L -n<\/code><\/pre>\n\n\n<p class=\"wp-block-paragraph\">If the required port is not open, allow it (for example <code>ufw allow 443\/tcp<\/code>). If your cloud or virtualization panel has a separate security group or network firewall, check that as well.<\/p>\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"4_Verify_the_DNS_Record\"><\/span>4. Verify the DNS Record<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n<p class=\"wp-block-paragraph\">Check with <code>nslookup yourdomain.com<\/code> that the domain&#8217;s A record points to the right server. Records still pointing to the old server after a migration send visitors to a machine that no longer serves the site.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E2%80%9CConnection_Refused%E2%80%9D_in_SSH\"><\/span>&#8220;Connection Refused&#8221; in SSH<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n<p class=\"wp-block-paragraph\">The message <code>ssh: connect to host \u2026 port 22: Connection refused<\/code> shows that the SSH service is not running, is listening on a different port, or that the firewall rejects port 22. Connect to the server through console (VNC) access and check the service with <code>systemctl status sshd<\/code>; if the port was changed, connect with <code>ssh -p 2222 user@ip<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E2%80%9CConnection_Refused%E2%80%9D_with_Databases\"><\/span>&#8220;Connection Refused&#8221; with Databases<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n<p class=\"wp-block-paragraph\">If your application gets this error when connecting to MySQL, PostgreSQL or Redis, the database service may have stopped, the wrong port or host name may be in use, or the database may accept only local connections. If the application and the database are on the same server, use <code>localhost<\/code> or <code>127.0.0.1<\/code> in the connection settings; if they are on different servers, check the database&#8217;s bind address and make sure the firewall allows only the application server&#8217;s IP.<\/p>\n\n\n<p class=\"wp-block-paragraph\">With a <a href=\"https:\/\/sunucun.com.tr\/en\/vds-server\">VDS server<\/a> that gives you root access, you can manage the services, ports and firewall yourself and apply all of these steps directly.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n<p class=\"wp-block-paragraph\">ERR_CONNECTION_REFUSED shows that the server was reached but no service accepts requests on the port you want to connect to, or a rule rejects the request. As a visitor, check your proxy settings and try from a different network. As a developer or server administrator, verify that the service is running, that it listens on the right address and port, and that the firewall allows that port.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>ERR_CONNECTION_REFUSED is an error showing that your browser reached a server but the server refused the connection request. Chrome then shows &#8220;\u2026 refused to connect&#8221; on the &#8220;This site can&#8217;t be reached&#8221; page together with the code ERR_CONNECTION_REFUSED. The same situation appears as a &#8220;Connection refused&#8221; message in command-line tools, SSH, database connections and apps.&hellip;<\/p>\n","protected":false},"author":1,"featured_media":21082,"comment_status":"","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[1523],"tags":[],"class_list":["post-21807","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-network"],"_links":{"self":[{"href":"https:\/\/sunucun.com.tr\/blog\/wp-json\/wp\/v2\/posts\/21807","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sunucun.com.tr\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sunucun.com.tr\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sunucun.com.tr\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sunucun.com.tr\/blog\/wp-json\/wp\/v2\/comments?post=21807"}],"version-history":[{"count":0,"href":"https:\/\/sunucun.com.tr\/blog\/wp-json\/wp\/v2\/posts\/21807\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sunucun.com.tr\/blog\/wp-json\/wp\/v2\/media\/21082"}],"wp:attachment":[{"href":"https:\/\/sunucun.com.tr\/blog\/wp-json\/wp\/v2\/media?parent=21807"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sunucun.com.tr\/blog\/wp-json\/wp\/v2\/categories?post=21807"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sunucun.com.tr\/blog\/wp-json\/wp\/v2\/tags?post=21807"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}