MisconfigurationError when running Certbot on Fresh installed Centos 8

Hello All,

I am running the Certbot on my fresh installed Centos 8 by following the instruction - https://certbot.eff.org/lets-encrypt/centosrhel8-apache

But I got the below error:

[root@web ~]# /usr/local/bin/certbot-auto --apache
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Error while running apachectl configtest.

AH00526: Syntax error on line 85 of /etc/httpd/conf.d/ssl.conf:
SSLCertificateFile: file '/etc/pki/tls/certs/localhost.crt' does not exist or is empty

The apache plugin is not working; there may be problems with your existing configuration.
The error was: MisconfigurationError("Error while running apachectl configtest.\n\nAH00526: Syntax error on line 85 of /etc/httpd/conf.d/ssl.conf:\nSSLCertificateFile: file '/etc/pki/tls/certs/localhost.crt' does not exist or is empty\n",)
[root@web ~]#

Before running the certbot, I have only added a new virtual host config file under /etc/httpd/conf.d/, all others leaves in default.

Please advise how to get the certfile /etc/pki/tls/certs/localhost.crt ?

Thanks.

Hi @watoan

is this a port 80 or a port 443 vHost? If you have added a port 443 vHost, that may be the problem.

Or create a self signed certificate (use OpenSsl) and copy that.

Or remove / disable the vHost with that error (first, make a backup).

I spotted mine (well remembered)… firewalld needs opening :slight_smile:

[root@shop conf]# firewall-cmd --zone=public --permanent --add-service=https
success
[root@shop conf]# firewall-cmd --zone=public --permanent --add-service=http
success
[root@shop conf]# firewall-cmd --reload
success
systemctl restart httpd