<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>err connection refused Archives - Hostnats</title>
	<atom:link href="https://www.hostnats.com/blog/category/err-connection-refused/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.hostnats.com/blog/category/err-connection-refused/</link>
	<description>The Perfect Hosting Partner</description>
	<lastBuildDate>Mon, 30 Mar 2026 09:53:44 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1</generator>

<image>
	<url>https://www.hostnats.com/blog/wp-content/uploads/2020/07/logo.png</url>
	<title>err connection refused Archives - Hostnats</title>
	<link>https://www.hostnats.com/blog/category/err-connection-refused/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>How to fix Digitalocean err connection refused Issue</title>
		<link>https://www.hostnats.com/blog/how-to-fix-digitalocean-err-connection-refused/</link>
		
		<dc:creator><![CDATA[Gopu Kumar]]></dc:creator>
		<pubDate>Tue, 25 Jan 2022 15:31:52 +0000</pubDate>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[DigitalOcean]]></category>
		<category><![CDATA[err connection refused]]></category>
		<category><![CDATA[digitalocean]]></category>
		<category><![CDATA[digitalocean error]]></category>
		<guid isPermaLink="false">https://www.hostnats.com/?p=4311</guid>

					<description><![CDATA[<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 [&#8230;]</p>
<p>The post <a href="https://www.hostnats.com/blog/how-to-fix-digitalocean-err-connection-refused/">How to fix Digitalocean err connection refused Issue</a> appeared first on <a href="https://www.hostnats.com/blog">Hostnats</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">The Digitalocean err connection refused issue might be caused by a firewall block or a missing log file.</p>



<p class="wp-block-paragraph">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>



<p class="wp-block-paragraph">See if we can&#8217;t come up with a workable solution to it today.</p>



<p class="wp-block-paragraph"><strong>Digitalocean err_connection_refused</strong></p>



<p class="wp-block-paragraph">To take a picture, a client recently shut down the droplet. When he got to the website, he found the following:</p>



<pre class="wp-block-code"><code>ERR_CONNECTION_REFUSED</code></pre>



<p class="wp-block-paragraph">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>



<p class="wp-block-paragraph">Next, we look into the Nginx service&#8217;s health:</p>



<pre class="wp-block-code"><code># service nginx status</code></pre>



<p class="wp-block-paragraph">Restarting the Nginx service is also a possibility:</p>



<pre class="wp-block-code"><code># service nginx restart</code></pre>



<p class="wp-block-paragraph">There are situations when we get the following error:</p>



<pre class="wp-block-code"><code>*Restarting nginx nginx &#91;fail]</code></pre>



<p class="wp-block-paragraph">Use the following command to verify the Nginx configuration:</p>



<pre class="wp-block-code"><code>$ sudo nginx -t</code></pre>



<p class="wp-block-paragraph">Then we shall receive:</p>



<pre class="wp-block-code"><code>nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx &#91;emerg] open() “/var/log/nginx/mysitename/access.log” failed (2: No such file or directory)
nginx: configuration file /etc/nginx/nginx.conf test failed</code></pre>



<p class="wp-block-paragraph">The following are the most common contributing factors:</p>



<p class="wp-block-paragraph">1. A firewall prevents the connection.</p>



<p class="wp-block-paragraph">2. A service listening on localhost.</p>



<p class="wp-block-paragraph">3. A missing log file.</p>



<p class="wp-block-paragraph">Solution</p>



<ul class="wp-block-list">
<li>Fill out a blank log file.</li>
</ul>



<p class="wp-block-paragraph">Root privileges are required to do this task.</p>



<pre class="wp-block-code"><code># touch /var/log/nginx/mysitename/access.log</code></pre>



<p class="wp-block-paragraph">The intermediate directory will be missing if it fails.</p>



<p class="wp-block-paragraph">Nginx has access to new and changed ownership and permissions:</p>



<pre class="wp-block-code"><code># mkdir -p /var/log/nginx/mysitename</code></pre>



<p class="wp-block-paragraph">The chown and chmod commands are used to ensure that the right user has access to the files.</p>



<ul class="wp-block-list">
<li>Use curl or wget to see whether the site can be accessed from the server.</li>
</ul>



<p class="wp-block-paragraph">Ports 80 and 443 must be opened in the firewall. In the Nginx configuration file, we also set it.</p>



<p class="wp-block-paragraph">Initially, we verify the condition of port 443 in the server using the netstat command:</p>



<pre class="wp-block-code"><code>netstat -plan | grep :443</code></pre>



<p class="wp-block-paragraph">We opened port 443 on the firewall when we discovered it was blocked. To open a port, various firewalls use a different approaches.</p>



<p class="wp-block-paragraph">For example, we may use the following syntax in iptables to open port 443:</p>



<pre class="wp-block-code"><code>iptables -A INPUT -p tcp –dport 443 -j ACCEPT</code></pre>



<p class="wp-block-paragraph">Similar to this, we may use: to open a port in firewalld on a CentOS server:</p>



<pre class="wp-block-code"><code>firewall-cmd –permanent –zone=public –add-port=443/tcp</code></pre>



<p class="wp-block-paragraph">/etc/nginx/nginx.conf is edited to include the following:</p>



<pre class="wp-block-code"><code>listen 443 ssl http/2 default_server;
listen &#91;::]:80 default_server;</code></pre>



<p class="wp-block-paragraph">It will allow HTTPS connections by adding port 443 to the Nginx server&#8217;s listening port.</p>



<p class="wp-block-paragraph">Finally, here is what port 443 will look like when Nginx is listening for traffic:</p>



<pre class="wp-block-code"><code>&#91;root@xxx ~]# netstat -lpan | grep :443
tcp 0 0 1xx.2x.111.23:443 0.0.0.0:* LISTEN 11978/nginx
tcp 0 0 1xx.2x.111.22:443 0.0.0.0:* LISTEN 11978/nginx
tcp 0 0 1xx.2x.111.19:443 0.0.0.0:* LISTEN 11978/nginx</code></pre>



<p class="wp-block-paragraph">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>
<p>The post <a href="https://www.hostnats.com/blog/how-to-fix-digitalocean-err-connection-refused/">How to fix Digitalocean err connection refused Issue</a> appeared first on <a href="https://www.hostnats.com/blog">Hostnats</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
