• We value your experience with Plesk during 2024
    Plesk strives to perform even better in 2025. To help us improve further, please answer a few questions about your experience with Plesk Obsidian 2024.
    Please take this short survey:

    https://pt-research.typeform.com/to/AmZvSXkx
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Issue 502 Bad Gateway - New Install - Restored from Backup

Don

New Pleskian
Server operating system version
CentOS 7.9
Plesk version and microupdate number
Plesk Obsidian Version 18.0.63 Update #2, last updated on Aug 19, 2024 07:54 PM
I have a Plesk Web Host Edition (CentOs 7.9) with a damaged database, but a good backup from the night before. I created a new Plesk server and purchased a new license. I then imported a backup file to restore all of the web sites. While I can get into the Plesk server, I cannot get any of the domains web sites to come up, even after using Lets Encrypt and GlobalSign SSL Certificates. The only thing I get is 502 Bad Gateway nginx. I have looked the entire day for a solution but nothing has fixed this issue. Where should I start to troubleshoot this issue and what log files should I be looking at? Both nginx and apache services are running. Thank you
 
One thing that worked for some of my restored sites that were getting the 502 Bad Gateway nginx error, is going into the domain management, Hosting & DNS, Apache & nginx, then under nginx settings, remove the checkbox for Proxy Mode. This has worked for a few sites so far.
 
This means that Apache is not running. Nginx might, but your Apache is not online. For that reason sites not using proxy mode work, because there Apache is not needed. So check this:

# service httpd status

and restart with
# service httpd restart

it will also show you why it doesn't start. If it is not displayed or unreadable, dive into /var/log/httpd/error_log or /var/log/messages to find the cause why Apache doesn't want to start.
 
That's not the same. Even if no issues are found, the port link and configuration between Apache and Nginx might be broken. It normally helps to run

# plesk repair web all

(without -n, so that it really reconfigures all necessary files). I first observed this necessity after migration from CentOS to Alma. After almost each OS update, the web configuration was broken, although all files looked fine at sight. Anyway it was necessary to run tthe repair web all to reconigure all, and only after doing that, Apache became available again for Nginx requests.
 
@Bitpalast
Thank you very much for your assistance and being the only one willing to help me. Much appreciated.

I ran:
# plesk repair all
(it's either web or all, can't have both options)

I didn't end up going through all the questions and options on this plesk repair command for a few different reasons. First, I don't think a brand new install should have to go through all of this. The plesk backup that I had available has failed me and is way too complicated to get something restored. And it ultimately doesn't really work that well. I have so many problems with this brand new install of Plesk after the restore that I will never use this method again.

What I ended up doing was using back ups from All-In-One WP Migration. Although I did have to buy their unlimited size add-on/plug-in because the free version only allows for a 128mb max import, it was well worth it. After deleting the WP and reinstalling WP, I was immediately able to do a restore of the site, and it worked perfectly on every domain/site. The only thing that still persists is having to turn off Proxy for the nginx/Apache to fix the 502 Bad Gateway problem. I also cannot enable the Fail2Ban services and a few other problems with this brand new install of Plesk.
 
Not being able to start Fail2Ban can have all kinds of reasons. When you run
# service fail2ban start
it will normally tell you why it won't start. If you don't see anything, run
# service fail2ban status
afterwards, then you can normally see an error message line in the output why it does not want to start.

The 502 is very likely caused by an unavailable Apache service. If Apache is running for sure, "plesk repair web" can solve it. If that cannot solve it either, A firewall might block ports. Could it be possible that you have firewalld running? Disable it and remove the service, reboot afterwards.
 
New Server? Check the IPs and the IPs of the subscriptions? Are they the same? Reread the IPs if there are additional ones. When install the backup did you just install the Datas or also the webconfigs. are the webconfigs from a timestamp the old server did not work?
 
Back
Top