Fix WHM Connection Refused During cPanel Migration
In this article
When you run a cPanel migration or transfer in WHM and get a "Connection refused" error, it usually means the destination server cannot reach the source server's transfer port (typically 2087) or the source server's firewall is blocking the connection. This guide walks you through the most common fixes, from checking network connectivity to adjusting firewall rules and verifying service status.
What You'll Need
- Root or WHM access to both the source and destination servers
- SSH access to both servers (for command-line checks)
- IP addresses and root passwords (or SSH keys) for both servers
- Basic familiarity with WHM's Transfer Tool and command-line navigation
Step-by-Step
- Verify the source server's IP address and port. In WHM, go to Home > Transfers and confirm you entered the correct source server IP. The default transfer port is 2087 (for WHM over SSL). If you used a custom port, ensure it matches the source server's configuration.
- Check if the source server is reachable from the destination. From the destination server's SSH terminal, run:
ping -c 4 SOURCE_IP
If ping fails, the server may be down or a network issue exists. Also test the transfer port:nc -zv SOURCE_IP 2087
If you get "Connection refused" here, the port is closed or the service isn't listening. - Ensure the cPanel services are running on the source server. SSH into the source server and check:
ps aux | grep -E 'cpsrvd|cpanel'
Or restart the services if needed:/scripts/restartsrv_cpsrvd
Also check that the firewall is not blocking port 2087. - Check firewall rules on the source server. If CSF (ConfigServer Security & Firewall) is installed, run:
csf -g 2087
If it's not allowed, add it:csf -a SOURCE_IP
Or edit/etc/csf/csf.confand add port 2087 toTCP_IN, then restart CSF. For firewalld, use:firewall-cmd --permanent --add-port=2087/tcp && firewall-cmd --reload
For iptables, add a rule allowing inbound TCP on port 2087 from the destination IP. - Verify the destination server can resolve the source hostname. If you used a hostname instead of an IP, ensure DNS resolves correctly. Check with:
dig +short SOURCE_HOSTNAME
If it resolves to a different IP than expected, use the IP directly. - Check if the source server is behind NAT or a load balancer. If so, the transfer may need to use the public IP and the firewall must allow the connection from the destination's public IP. Sometimes you need to configure the transfer to use a specific interface.
- Try using the legacy transfer method. In WHM, go to Transfers and choose "Transfer accounts from another server" (legacy). This uses a different protocol (SSH) and may bypass the 2087 port issue. Ensure SSH is enabled on the source and port 22 is open.
- Check WHM logs for detailed errors. On the destination server, look at:
tail -f /var/log/cpanel/transfer.log
Or on the source server, check/var/log/cpanel/cpsrvd.logfor any connection attempts.
Common Mistakes
- Forgetting to open port 2087 on the source server's firewall. Even if the service is running, a firewall can silently drop or refuse connections.
- Using the wrong IP address. If the source server has multiple IPs, ensure you use the one that is publicly accessible from the destination.
- Not checking if the source server is in a different data center with network restrictions. Some hosting providers block cross-datacenter traffic on certain ports.
- Assuming the transfer port is always 2087. If you changed the WHM port during installation, the transfer will use that custom port.
Tips
- Always test the port connectivity from the destination server before starting the migration to save time.
- If you have a firewall like CSF, temporarily disable it on the source server to test if it's the cause, then re-enable and configure properly.
- Use SSH keys instead of passwords for transfers to avoid password-related issues.
- If the source server is very old (cPanel/WHM version 11.x), consider upgrading it first, as older versions may have compatibility issues with newer WHM.
Troubleshooting
If the steps above don't resolve the issue, try the following:
- Check if the source server's cpsrvd is listening on all interfaces. Run
netstat -tulpn | grep 2087on the source. If it only listens on localhost, edit/etc/cpsrvd.confor the WHM configuration to bind to 0.0.0.0. - Verify there is no IPtables rule that drops the connection. Use
iptables -L -nto see all rules and check for any REJECT or DROP entries. - Check if the destination server is blocking outbound connections. Run
nc -zv SOURCE_IP 2087from the destination. If it times out, the destination's firewall may be blocking outbound traffic. - Try connecting to the WHM port via browser. From the destination server, use
curl -k https://SOURCE_IP:2087to see if you get a response. If you get a timeout, the network path is blocked. - Look at the source server's error logs. Check
/var/log/messagesor/var/log/securefor any connection attempts and related errors. - If all else fails, contact your hosting provider. They may have network-level firewalls or security policies that block the transfer port.
Frequently Asked Questions
What port does WHM use for transfers?
By default, WHM uses port 2087 for SSL-secured transfers. If you changed the WHM port during setup, that custom port is used instead.
Can I use SSH port 22 for transfers instead of 2087?
Yes, the legacy transfer method uses SSH (port 22) to connect to the source server. This is often more reliable if port 2087 is blocked.
Why does the transfer work from my local computer but not from the destination server?
This usually indicates a firewall rule on the source server that only allows certain IPs. Ensure the destination server's IP is whitelisted.
Do I need root access on both servers to fix this?
Yes, you need root access to check firewall rules, restart services, and modify configurations on both servers.
How long does a typical cPanel migration take?
It varies widely depending on the number of accounts and data size. Small migrations can take minutes, while large ones may take hours.
What if the source server is running an old cPanel version?
Older versions may not be compatible with the latest WHM transfer tool. Consider upgrading the source server's cPanel/WHM first, or use the legacy transfer method.