How To Solve?: "ECONNREFUSED - connection refused by server" 
Tags: tutorial, help, beginners, webdev
Published: 2020-03-06 13:30:44

Chances are that while you&#39;ve been using [FileZilla](https://filezilla-project.org/) you&#39;ve also come across the **ECONNREFUSED - connection refused by a server** error. If that&#39;s the case - great that you&#39;ve found this tutorial! I am going to show you three methods that might help you with resolving this FTP error.

###First Method. Changing FileZilla&#39;s Default Port Value

The error could appear due to using the incorrect port while connecting through FileZilla. In this situation, you just need to **change the default FTP port to the default SFTP port** number. Simply change **21** to **22** on the &quot;**Port**&quot; input box.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/i28p239u4uzkqddmirno.png)

###Second Method. Disabling Anti-Virus/Firewall

Sometimes this error can occur when anti-virus software and/or firewall is refusing FileZilla&#39;s tries to make a connection.

In the event where anti-virus or firewall is causing ECONNREFUSED, what you need to do is simple. What you need to do: disable anti-virus and firewall and try to connect again. Firstly I&#39;ll show you how to do this on **macOS** :

+ Click the &quot;**Apple**&quot; icon on the top menu bar. Navigate to &quot;**System Preferences**&quot;.
+ Find the &quot;**Security & Privacy**&quot; settings.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/gx009fns10n2v8ydhuwf.png)

+ Go to the &quot;**Firewall**&quot; tab and select &quot;**Turn Off Firewall**&quot;.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/6y7u3xbhpooveu3fcyp3.png)

If you&#39;re using **Windows**, follow these steps:

+ Hit the &quot;**Windows&quot;** key and type in &quot;**Control Panel**&quot;.
+ Then go to &quot;**System and Security**&quot; and find &quot;**Windows Defender Firewall**&quot;.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/5qkth7sdk8usnizwu3p4.png)

+ Locate &quot;**Turn Windows Defender Firewall on or off**&quot; selection on the sidebar on the left.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/n4tpw1ylwzx8postypd7.png)

+ Alter the options to switch off Windows Defender Firewall for public and private networks, in the following window and click &quot;**Ok**&quot;.

For a thorough explanation of how to deactivate various anti-virus software, take a look at [this post](https://blog.pcrisk.com/windows/12405-how-to-temporarily-disable-your-antivirus).

If turning off the anti-virus or firewall doesn&#39;t help and you still get the ECONNREFUSED - connection refused by the server error - try the following method.

###Third Method. Altering FileZilla&#39;s Network Configuration Wizard

What should you do if the previous solutions don&#39;t bring the desired result? To fix the error, you can try altering FileZilla&#39;s network configurations:

+ [Connect to FileZilla FTP client](https://www.hostinger.com/tutorials/ftp/filezilla-ftp-configuration), then go to &quot;**Edit**&quot; and then to &quot;**Network Configuration Wizard**&quot;.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/gzd53la52s9gmo0tmag3.png)

+ When &quot;**Firewall and router configuration wizard**&quot; window appears, click &quot;**Next**&quot; to continue.
+ As the Default transfer mode select &quot;**Passive (recommended)**&quot;. Also, tick &quot;**Allow fallback to another transfer mode on failure**&quot; selection.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/gih10cgdv6q9leeutlv2.png)

+ Choose &quot;**Use server&#39;s external IP address instead**&quot;.
+ Select the &quot;**Get the external IP address from the following URL**&quot;. Enter the default value in case the input field is empty and continue (default value is [**http://ip.filezilla-project.org/ip.php**](http://ip.fillezilla-project.org/ip.php)).
+ Do not adjust the port range configuration and then choose the &quot;**Ask operating system for a port**&quot;.

At this point, you need to ensure that you&#39;ve made correct configurations. Hit the &quot;**Test**&quot; button to let FileZilla try to make a connection to **probe.filezilla-project.org** and it will perform some simple benchmarks.

If the test goes without any failures, attempt to connect to your hosting account once more. It should work perfectly well. In case the &quot;**ECONNREFUSED**&quot; error repeats itself, you should try reaching out to your hosting customer support to get some help.

###To Conclude

There you go - three methods of fixing ECONNREFUSED - connection refused by server error. Hopefully, one of these three methods will help you to fix this FileZilla error! If you have questions or more solutions for this error, do not hesitate to leave a comment!