{"id":4311,"date":"2022-01-25T21:01:52","date_gmt":"2022-01-25T15:31:52","guid":{"rendered":"https:\/\/www.hostnats.com\/?p=4311"},"modified":"2026-03-30T15:23:44","modified_gmt":"2026-03-30T09:53:44","slug":"how-to-fix-digitalocean-err-connection-refused","status":"publish","type":"post","link":"https:\/\/www.hostnats.com\/blog\/how-to-fix-digitalocean-err-connection-refused\/","title":{"rendered":"How to fix Digitalocean err connection refused Issue"},"content":{"rendered":"\n<p>The Digitalocean err connection refused issue might be caused by a firewall block or a missing log file.<\/p>\n\n\n\n<p>Our <a href=\"https:\/\/www.hostnats.com\/managed-digitalocean-hosting\" target=\"_blank\" rel=\"noreferrer noopener\">Managed DigitalOcean Cloud Hosting<\/a> Services provide assistance with a variety of these types of mistake inquiries.<\/p>\n\n\n\n<p>See if we can&#8217;t come up with a workable solution to it today.<\/p>\n\n\n\n<p><strong>Digitalocean err_connection_refused<\/strong><\/p>\n\n\n\n<p>To take a picture, a client recently shut down the droplet. When he got to the website, he found the following:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ERR_CONNECTION_REFUSED<\/code><\/pre>\n\n\n\n<p>As a first step, we look at the Digitalocean dashboard to see whether everything is powered on. In addition, we examine the boot messages in the Digitalocean console.<\/p>\n\n\n\n<p>Next, we look into the Nginx service&#8217;s health:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># service nginx status<\/code><\/pre>\n\n\n\n<p>Restarting the Nginx service is also a possibility:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># service nginx restart<\/code><\/pre>\n\n\n\n<p>There are situations when we get the following error:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>*Restarting nginx nginx &#91;fail]<\/code><\/pre>\n\n\n\n<p>Use the following command to verify the Nginx configuration:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo nginx -t<\/code><\/pre>\n\n\n\n<p>Then we shall receive:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nginx: the configuration file \/etc\/nginx\/nginx.conf syntax is ok\r\nnginx &#91;emerg] open() \u201c\/var\/log\/nginx\/mysitename\/access.log\u201d failed (2: No such file or directory)\r\nnginx: configuration file \/etc\/nginx\/nginx.conf test failed<\/code><\/pre>\n\n\n\n<p>The following are the most common contributing factors:<\/p>\n\n\n\n<p>1. A firewall prevents the connection.<\/p>\n\n\n\n<p>2. A service listening on localhost.<\/p>\n\n\n\n<p>3. A missing log file.<\/p>\n\n\n\n<p>Solution<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Fill out a blank log file.<\/li>\n<\/ul>\n\n\n\n<p>Root privileges are required to do this task.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># touch \/var\/log\/nginx\/mysitename\/access.log<\/code><\/pre>\n\n\n\n<p>The intermediate directory will be missing if it fails.<\/p>\n\n\n\n<p>Nginx has access to new and changed ownership and permissions:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># mkdir -p \/var\/log\/nginx\/mysitename<\/code><\/pre>\n\n\n\n<p>The chown and chmod commands are used to ensure that the right user has access to the files.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Use curl or wget to see whether the site can be accessed from the server.<\/li>\n<\/ul>\n\n\n\n<p>Ports 80 and 443 must be opened in the firewall. In the Nginx configuration file, we also set it.<\/p>\n\n\n\n<p>Initially, we verify the condition of port 443 in the server using the netstat command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>netstat -plan | grep :443<\/code><\/pre>\n\n\n\n<p>We opened port 443 on the firewall when we discovered it was blocked. To open a port, various firewalls use a different approaches.<\/p>\n\n\n\n<p>For example, we may use the following syntax in iptables to open port 443:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>iptables -A INPUT -p tcp \u2013dport 443 -j ACCEPT<\/code><\/pre>\n\n\n\n<p>Similar to this, we may use: to open a port in firewalld on a CentOS server:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>firewall-cmd \u2013permanent \u2013zone=public \u2013add-port=443\/tcp<\/code><\/pre>\n\n\n\n<p>\/etc\/nginx\/nginx.conf is edited to include the following:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>listen 443 ssl http\/2 default_server;\r\nlisten &#91;::]:80 default_server;<\/code><\/pre>\n\n\n\n<p>It will allow HTTPS connections by adding port 443 to the Nginx server&#8217;s listening port.<\/p>\n\n\n\n<p>Finally, here is what port 443 will look like when Nginx is listening for traffic:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@xxx ~]# netstat -lpan | grep :443\r\ntcp 0 0 1xx.2x.111.23:443 0.0.0.0:* LISTEN 11978\/nginx\r\ntcp 0 0 1xx.2x.111.22:443 0.0.0.0:* LISTEN 11978\/nginx\r\ntcp 0 0 1xx.2x.111.19:443 0.0.0.0:* LISTEN 11978\/nginx<\/code><\/pre>\n\n\n\n<p>Instead of 127.0.0.1, we make sure that the service listens on 0.0,0 (localhost). Setting it in the nginx.conf file is an option.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Digitalocean err connection refused issue might be caused by a firewall block or a missing log file. Our Managed DigitalOcean Cloud Hosting Services provide assistance with a variety of these types of mistake inquiries. See if we can&#8217;t come up with a workable solution to it today. Digitalocean err_connection_refused To take a picture, a [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[49,61,299],"tags":[286,300],"class_list":["post-4311","post","type-post","status-publish","format-standard","hentry","category-blog","category-digitalocean","category-err-connection-refused","tag-digitalocean","tag-digitalocean-error"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v24.4 (Yoast SEO v27.2) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>DigitalOcean ERR Connection Refused: Quick Fix Guide<\/title>\n<meta name=\"description\" content=\"There is a possibility that a firewall block or a missing log file is the root cause of the Digitalocean err connection refused issue.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.hostnats.com\/blog\/how-to-fix-digitalocean-err-connection-refused\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to fix Digitalocean err connection refused Issue\" \/>\n<meta property=\"og:description\" content=\"There is a possibility that a firewall block or a missing log file is the root cause of the Digitalocean err connection refused issue.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.hostnats.com\/blog\/how-to-fix-digitalocean-err-connection-refused\/\" \/>\n<meta property=\"og:site_name\" content=\"Hostnats\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/hostnats\" \/>\n<meta property=\"article:published_time\" content=\"2022-01-25T15:31:52+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-03-30T09:53:44+00:00\" \/>\n<meta name=\"author\" content=\"Gopu Kumar\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@hostnats\" \/>\n<meta name=\"twitter:site\" content=\"@hostnats\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Gopu Kumar\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.hostnats.com\/blog\/how-to-fix-digitalocean-err-connection-refused\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.hostnats.com\/blog\/how-to-fix-digitalocean-err-connection-refused\/\"},\"author\":{\"name\":\"Gopu Kumar\",\"@id\":\"https:\/\/www.hostnats.com\/blog\/#\/schema\/person\/e913d744f9f4f9a2ed5f95c409f5cc10\"},\"headline\":\"How to fix Digitalocean err connection refused Issue\",\"datePublished\":\"2022-01-25T15:31:52+00:00\",\"dateModified\":\"2026-03-30T09:53:44+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.hostnats.com\/blog\/how-to-fix-digitalocean-err-connection-refused\/\"},\"wordCount\":380,\"publisher\":{\"@id\":\"https:\/\/www.hostnats.com\/blog\/#organization\"},\"keywords\":[\"digitalocean\",\"digitalocean error\"],\"articleSection\":[\"Blog\",\"DigitalOcean\",\"err connection refused\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.hostnats.com\/blog\/how-to-fix-digitalocean-err-connection-refused\/\",\"url\":\"https:\/\/www.hostnats.com\/blog\/how-to-fix-digitalocean-err-connection-refused\/\",\"name\":\"DigitalOcean ERR Connection Refused: Quick Fix Guide\",\"isPartOf\":{\"@id\":\"https:\/\/www.hostnats.com\/blog\/#website\"},\"datePublished\":\"2022-01-25T15:31:52+00:00\",\"dateModified\":\"2026-03-30T09:53:44+00:00\",\"description\":\"There is a possibility that a firewall block or a missing log file is the root cause of the Digitalocean err connection refused issue.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.hostnats.com\/blog\/how-to-fix-digitalocean-err-connection-refused\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.hostnats.com\/blog\/how-to-fix-digitalocean-err-connection-refused\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.hostnats.com\/blog\/how-to-fix-digitalocean-err-connection-refused\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.hostnats.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to fix Digitalocean err connection refused Issue\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.hostnats.com\/blog\/#website\",\"url\":\"https:\/\/www.hostnats.com\/blog\/\",\"name\":\"Hostnats\",\"description\":\"The Perfect Hosting Partner\",\"publisher\":{\"@id\":\"https:\/\/www.hostnats.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.hostnats.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.hostnats.com\/blog\/#organization\",\"name\":\"Hostnats Hosting\",\"url\":\"https:\/\/www.hostnats.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.hostnats.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.hostnats.com\/blog\/wp-content\/uploads\/2020\/07\/logo.png\",\"contentUrl\":\"https:\/\/www.hostnats.com\/blog\/wp-content\/uploads\/2020\/07\/logo.png\",\"width\":66,\"height\":67,\"caption\":\"Hostnats Hosting\"},\"image\":{\"@id\":\"https:\/\/www.hostnats.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/hostnats\",\"https:\/\/x.com\/hostnats\",\"https:\/\/www.instagram.com\/hostnats_hosting\/\",\"https:\/\/www.linkedin.com\/company\/hostnats\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.hostnats.com\/blog\/#\/schema\/person\/e913d744f9f4f9a2ed5f95c409f5cc10\",\"name\":\"Gopu Kumar\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/3a04e307992cf527a3f7224d55ec81767a1094f0278d86fb791aa46b3552bc8c?s=96&d=mm&r=g\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/3a04e307992cf527a3f7224d55ec81767a1094f0278d86fb791aa46b3552bc8c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/3a04e307992cf527a3f7224d55ec81767a1094f0278d86fb791aa46b3552bc8c?s=96&d=mm&r=g\",\"caption\":\"Gopu Kumar\"}}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"DigitalOcean ERR Connection Refused: Quick Fix Guide","description":"There is a possibility that a firewall block or a missing log file is the root cause of the Digitalocean err connection refused issue.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.hostnats.com\/blog\/how-to-fix-digitalocean-err-connection-refused\/","og_locale":"en_US","og_type":"article","og_title":"How to fix Digitalocean err connection refused Issue","og_description":"There is a possibility that a firewall block or a missing log file is the root cause of the Digitalocean err connection refused issue.","og_url":"https:\/\/www.hostnats.com\/blog\/how-to-fix-digitalocean-err-connection-refused\/","og_site_name":"Hostnats","article_publisher":"https:\/\/www.facebook.com\/hostnats","article_published_time":"2022-01-25T15:31:52+00:00","article_modified_time":"2026-03-30T09:53:44+00:00","author":"Gopu Kumar","twitter_card":"summary_large_image","twitter_creator":"@hostnats","twitter_site":"@hostnats","twitter_misc":{"Written by":"Gopu Kumar","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.hostnats.com\/blog\/how-to-fix-digitalocean-err-connection-refused\/#article","isPartOf":{"@id":"https:\/\/www.hostnats.com\/blog\/how-to-fix-digitalocean-err-connection-refused\/"},"author":{"name":"Gopu Kumar","@id":"https:\/\/www.hostnats.com\/blog\/#\/schema\/person\/e913d744f9f4f9a2ed5f95c409f5cc10"},"headline":"How to fix Digitalocean err connection refused Issue","datePublished":"2022-01-25T15:31:52+00:00","dateModified":"2026-03-30T09:53:44+00:00","mainEntityOfPage":{"@id":"https:\/\/www.hostnats.com\/blog\/how-to-fix-digitalocean-err-connection-refused\/"},"wordCount":380,"publisher":{"@id":"https:\/\/www.hostnats.com\/blog\/#organization"},"keywords":["digitalocean","digitalocean error"],"articleSection":["Blog","DigitalOcean","err connection refused"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.hostnats.com\/blog\/how-to-fix-digitalocean-err-connection-refused\/","url":"https:\/\/www.hostnats.com\/blog\/how-to-fix-digitalocean-err-connection-refused\/","name":"DigitalOcean ERR Connection Refused: Quick Fix Guide","isPartOf":{"@id":"https:\/\/www.hostnats.com\/blog\/#website"},"datePublished":"2022-01-25T15:31:52+00:00","dateModified":"2026-03-30T09:53:44+00:00","description":"There is a possibility that a firewall block or a missing log file is the root cause of the Digitalocean err connection refused issue.","breadcrumb":{"@id":"https:\/\/www.hostnats.com\/blog\/how-to-fix-digitalocean-err-connection-refused\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.hostnats.com\/blog\/how-to-fix-digitalocean-err-connection-refused\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.hostnats.com\/blog\/how-to-fix-digitalocean-err-connection-refused\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.hostnats.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to fix Digitalocean err connection refused Issue"}]},{"@type":"WebSite","@id":"https:\/\/www.hostnats.com\/blog\/#website","url":"https:\/\/www.hostnats.com\/blog\/","name":"Hostnats","description":"The Perfect Hosting Partner","publisher":{"@id":"https:\/\/www.hostnats.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.hostnats.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.hostnats.com\/blog\/#organization","name":"Hostnats Hosting","url":"https:\/\/www.hostnats.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.hostnats.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.hostnats.com\/blog\/wp-content\/uploads\/2020\/07\/logo.png","contentUrl":"https:\/\/www.hostnats.com\/blog\/wp-content\/uploads\/2020\/07\/logo.png","width":66,"height":67,"caption":"Hostnats Hosting"},"image":{"@id":"https:\/\/www.hostnats.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/hostnats","https:\/\/x.com\/hostnats","https:\/\/www.instagram.com\/hostnats_hosting\/","https:\/\/www.linkedin.com\/company\/hostnats"]},{"@type":"Person","@id":"https:\/\/www.hostnats.com\/blog\/#\/schema\/person\/e913d744f9f4f9a2ed5f95c409f5cc10","name":"Gopu Kumar","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/3a04e307992cf527a3f7224d55ec81767a1094f0278d86fb791aa46b3552bc8c?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/3a04e307992cf527a3f7224d55ec81767a1094f0278d86fb791aa46b3552bc8c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/3a04e307992cf527a3f7224d55ec81767a1094f0278d86fb791aa46b3552bc8c?s=96&d=mm&r=g","caption":"Gopu Kumar"}}]}},"_links":{"self":[{"href":"https:\/\/www.hostnats.com\/blog\/wp-json\/wp\/v2\/posts\/4311","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostnats.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostnats.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostnats.com\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostnats.com\/blog\/wp-json\/wp\/v2\/comments?post=4311"}],"version-history":[{"count":1,"href":"https:\/\/www.hostnats.com\/blog\/wp-json\/wp\/v2\/posts\/4311\/revisions"}],"predecessor-version":[{"id":6509,"href":"https:\/\/www.hostnats.com\/blog\/wp-json\/wp\/v2\/posts\/4311\/revisions\/6509"}],"wp:attachment":[{"href":"https:\/\/www.hostnats.com\/blog\/wp-json\/wp\/v2\/media?parent=4311"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostnats.com\/blog\/wp-json\/wp\/v2\/categories?post=4311"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostnats.com\/blog\/wp-json\/wp\/v2\/tags?post=4311"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}