Applicable to:
- Plesk for Linux
Symptoms
- All websites on the Plesk server are showing a 502 Bad Gateway error while opened in a browser
-
Attempts to start Apache and Apache configuration tests fail with an error that is similar to the following:
CONFIG_TEXT: 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 -
The following error is shown in the Plesk GUI:
PLESK_ERROR: 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
-
That SSL certificate that is reported in the error message has zero size:
-
For RHEL-based OS (CentOS, CloudLinux, RedHat:
# ls -l /usr/local/psa/var/certificates/cert1Ape62
...
-r-------- 1 root root 0 Mar 24 12:26 /opt/psa/var/certificates/cert1Ape62 -
For Debian-based OS (Debian, Ubuntu):
# ls -l /opt/psa/var/certificates/cert1Ape62
...
-r-------- 1 root root 0 Mar 24 12:26 /opt/psa/var/certificates/cert1Ape62
-
-
The Plesk web server reconfiguration utility fails with an error that is similar to the following:
# /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 -
Repairing files system permissions with the plesk repair utility results in an error that is similar to the following:
# 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 -
All websites on the server are not accessible, while showing a browser error that is similar to the following :
CONFIG_TEXT: 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:
-
Connect to the server via SSH
-
Rebuild the missing or corrupted certificates for domains by using the following command:
# plesk repair web -sslcerts
-
Check the Apache configuration files for errors:
-
For RHEL-based OS (CentOS, CloudLinux, RedHat:
# httpd -t
The expected output is the following
CONFIG_TEXT: Syntax OK
-
For Debian-based OS (Debian, Ubuntu):
# apache2ctl configtest
The expected output is the following
CONFIG_TEXT: Syntax OK
-
-
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.
Comments
0 comments
Please sign in to leave a comment.