How to Fix ECONNREFUSED - Connection Refused By The Server Error
Many web hosts offer FTP access to edit the core files of a site. FileZilla is one of the most popular tools. While connecting it to your FTP account, you might get an ECONNREFUSED - Connection Refused By The Server Error.
In this tutorial, you will learn about different methods to fix such an error. In many cases, people use the wrong port for FileZilla, but that's not the only reason things can go wrong.
1). Change the FileZilla's Default Port
As you might already know, most companies focus on the security of their server and the sites hosted on it. So, instead of FTP, they are offering SFTP for a secure connection.
FileZilla might not connect with the default FTP port because your web hosting might be using SFTP. The default port for an FTP connection is 21.
So, you should use 22, which is the default SFTP port value. After changing the port value, FileZilla will establish a secure connection that your web hosting company allows.
2). Disable the Firewall or an Antivirus You Use
In most cases, an antivirus creates an issue while connecting to a server because of its firewall. So, it's always a good idea to disable the antivirus you have installed on your computer.
If you don't have an antivirus, your computer might have a firewall turned on; you have to turn it off.
If you're using macOS, here are a few steps to follow:
- Click on the Apple logo from the top-left corner of your laptop/computer and click on "System Preferences."
- Open "Security & Privacy".
- Click on the "Firewall" tab and turn it off.
For Windows, here are a few steps:
- Open the Control Panel and click on "System and Security."
- Find the Windows Defender Firewall and turn it off.
If the firewall or antivirus is the reason behind the ECONNREFUSED - Connection Refused By The Server error, it will be resolved as soon as you follow the above-mentioned steps.
3). Change the FileZilla's Network Firewall Setting
Just like your computer, FileZilla also has a firewall to protect your data transfer after establishing a secure connection. To access those firewall settings, here are a few steps to follow:
- Connect FileZilla to your hosting's FTP account.
- After that, you will see many options on the FileZilla toolbar. Click on Edit>>Network Configuration Wizard.
- It will display a popup, click Next.
- On another popup, you have to select "Passive" as the firewall setting because it's the default transfer mode.
- You have to also check the box for "Allow fallback to another transfer mode on failure."
- On the next popup, select "Use the server's external IP address instead."
- Select "Choose the external IP address from the following URL" Here is the URL: http://ip.filezilla-project.org/ip.php
After making all these changes, FileZilla will try to connect to the server again. If it doesn't happen, please close it and restart for a secure connection.
If the test is successful, you won't get an error while using FileZilla to transfer any files and folder from or to your hosting account to your computer/laptop.
In all the mentioned methods, there is one common thing. Everything is related to having a connection, whether it's about the wrong port or settings.
However, the firewall of a computer/laptop is a little bit different. I hope you won't get the ECONNREFUSED - Connection Refused By The Server Error after troubleshooting.