Author Topic: Urgent Help Needed: 502 Bad Gateway Error After Migrating Site from cPanel  (Read 192 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
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:
 
Code: [Select]
  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, 

Offline
*****
Re: Urgent Help Needed: 502 Bad Gateway Error After Migrating Site from cPanel
« Reply #1 on: September 18, 2024, 05:01:03 PM »
What is your webserver configuration? Just Apache? Apache + Nginx? Varnish? Does creating a new user (and domain) work as expected?

Offline
*
Re: Urgent Help Needed: 502 Bad Gateway Error After Migrating Site from cPanel
« Reply #2 on: September 18, 2024, 05:38:56 PM »
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.

Offline
*****
Re: Urgent Help Needed: 502 Bad Gateway Error After Migrating Site from cPanel
« Reply #3 on: September 18, 2024, 07:04:33 PM »
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.