Cobra Forum

Plesk Panel => Webserver => Topic started by: Suhitha on Aug 26, 2025, 05:54 AM

Title: All websites are down with 502 Bad Gateway error: apache2 or httpd is not
Post by: Suhitha on Aug 26, 2025, 05:54 AM
Question: All websites are down with 502 Bad Gateway error: apache2 or httpd is not running


Applicable to:



Symptoms


AH00526: Syntax error on line 51 of /etc/apache2/plesk.conf.d/vhosts/example.com.conf:
SSLCertificateFile: file '/opt/psa/var/certificates/cert1Ape62' does not exist or is empty


New configuration files for the Apache web server were not created due to the errors in configuration templates: nginx: [emerg] BIO_new_file("/usr/local/psa/var/certificates/cert1Ape62") failed (SSL: error:02001002:system library:fopen:No such file or directory:fopen('/usr/local/psa/var/certificates/cert1Ape62','r') error:2006D080:BIO routines:BIO_new_file:no such file) nginx: configuration file /etc/nginx/nginx.conf test failed . Detailed error descriptions were sent to you by email. Please resolve the issues and click here to generate broken configuration files once again or here to generate all configuration files. See the details in Configuration Troubleshooter

     
#ls -l /usr/local/psa/var/certificates/cert1Ape62
...
-r-------- 1 root root 0 Mar 24 12:26 /opt/psa/var/certificates/cert1Ape62

     


#ls -l /opt/psa/var/certificates/cert1Ape62
...
-r-------- 1 root root 0 Mar 24 12:26 /opt/psa/var/certificates/cert1Ape62

#/usr/local/psa/admin/bin/httpdmng --reconfigure-domain example.com
...
ERR [panel] Apache config (14972022740.47990300) generation failed: Template_Exception: Syntax error on line 51 of /etc/httpd/conf/plesk.conf.d/ip_default/example.conf:
SSLCACertificateFile: file '/usr/local/psa/var/certificates/cert1Ape62' does not exist or is empty

#plesk repair fs -y -v
Checking Linux system files ......................................... [OK]
Checking virtual hosts' file system
There are incorrect permissions on some items in the system
directory for the domain 'example.com' .......................... [ERROR]
- Failed to stat
/var/www/vhosts/system/example.com/conf/webalizer.conf: No
such file or directory
Repairing incorrect permissions ................................. [FAILED]
- openat 'webalizer.conf' failed: No such file or directory
Failed to open safely
/var/www/vhosts/system/example.com/conf/webalizer.conf: No
such file or directory

ERR_CONNECTION_REFUSED


Cause

The SSL certificate file that is reported in the error message is missing or is corrupted, due to which it has an improper size or is not found at all.


Resolution


Note: If the domain example.com was removed previously from the server, apply the solution from the article: Apache or nginx fails to start: BIO_new_file: certificate not found: No such file or directory: nginx: configuration file /etc/nginx/nginx.conf test failed

Recreate the SSL certificates on the server by following these steps:


1.Connect to the server via SSH

2.Rebuild the missing or corrupted certificates for domains by using the following command:

#plesk repair web -sslcerts

3.Check the Apache configuration files for errors:


#httpd -t

The expected output is the following

Syntax OK
:

#apache2ctl configtest

The expected output is the following
Syntax OK
4.Rebuild the Apache configuration files for all domains on the server:

Warning: During this operation websites will be unavailable for a short period of time. The execution time of this command depends on the number of domains on the server.

#/usr/local/psa/admin/bin/httpdmng --reconfigure-all

If steps aforementioned steps was not helped remove files manually and repeat steps 1-4 again:

#rm -f /etc/nginx/plesk.conf.d/webmails/*
#rm -f /etc/httpd/conf/plesk.conf.d/webmails/*
#rm -f /etc/httpd/conf/plesk.conf.d/server.conf

Note: the certificate file may still exist in the nginx config /etc/nginx/plesk.conf.d/server.conf, disabling or enabling nginx should fix the issue.