Urgent Help Needed: 502 Bad Gateway Error After Migrating Site from cPanel

Started by machadoug, September 17, 2024, 08:46:52 PM

Previous topic - Next topic

machadoug

Hi everyone,

I'm currently in the process of migrating all my sites from cPanel to a new server running CWP. However, I've encountered an issue with the third site I migrated, the first two are working correctly. When accessing the site via its domain, I'm getting a "502 Bad Gateway" error. Interestingly, accessing the site through [ip]/~user/ it works fine, and accessing a subdomain also functions correctly.

Here's a more detailed look at the situation:

1. Error Message: The site shows "502 Bad Gateway" when accessed via its domain.
2. Working Access: Accessing the site through [ip]/~user/ is successful.
3. Subdomain Access: Subdomains are functioning correctly.
4. Log Files: In the error log file `/usr/local/apache/domlogs/[domain].error.log`, I'm seeing the following entry:
  connect() failed (111: Connection refused) while connecting to upstream

I'm planning to revert the DNS settings to point back to the old server for now to avoid downtime.

Has anyone encountered a similar issue, or does anyone have suggestions on how to resolve this? Any help or insights would be greatly appreciated.

Thank you in advance!

Best regards, 

overseer

What is your webserver configuration? Just Apache? Apache + Nginx? Varnish? Does creating a new user (and domain) work as expected?

machadoug

Thank you for your reply.
Nginx + Varnish + Apache.

I realized Varnish wasn't working properly and the error was gone, once I changed it to Nginx + Apache. I'm not sure the other site was affected.

Anyway, it's now working. I'll try to solve the Varnish issue at a later stage.

overseer

Always a good plan -- simplify your config then add in the cache when you are in production and need to milk the last 20% performance out of it.