Certs got, but not working

First, thank you EFF for providing free SSL certificate for everyone.
I was installing certbot on my virtual-host-server, I follow the instructions and encounter this:

    Unable to find a virtual host listening on port 80 which is currently needed for Certbot to prove to the CA that you control your domain. Please add a virtual host for port 80.

I search the web for help, and one post told me to add a virtual host like this:

<VirtualHost *:80>
    DocumentRoot "/var/www/html"
    ServerName i.dongde.com
</VirtualHost>

I did it, and everything went well.

Congratulations! You have successfully enabled https://i.dongde.com

But the certificate is not valid, please help

My domain is: i.dongde.com

I ran this command: follow the certbot instructions

It produced this output: Congratulations! You have successfully enabled https://i.dongde.com

My web server is (include version): Apache/2.4.6 (CentOS7)

The operating system my web server runs on is (include version): CentOS

My hosting provider, if applicable, is: Vultr

I can login to a root shell on my machine (yes or no, or I don’t know): Yes

1 Like

A few questions:

  1. What was the exact command you ran?
  2. What is the output of [whichever you ran]:
    certbot certificates
    or
    certbot-auto certificates
  3. What does this show?:
    apachectl -S
1 Like

1

yum install epel-release

yum -y install yum-utils

yum-config-manager --enable rhui-REGION-rhel-server-extras rhui-REGION-rhel-server-optional

sudo certbot --apache

echo "0 0,12 * * * root python -c 'import random; import time; time.sleep(random.random() * 3600)' && certbot renew" | sudo tee -a /etc/crontab > /dev/null

2

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache
Starting new HTTPS connection (1): acme-v02.api.letsencrypt.org

Which names would you like to activate HTTPS for?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: i.dongde.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel): i.dongde.com
** Error - Invalid selection **

Which names would you like to activate HTTPS for?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: i.dongde.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel): 1
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for i.dongde.com
Waiting for verification...
Cleaning up challenges
Created an SSL vhost at /etc/httpd/conf/httpd-le-ssl.conf
Deploying Certificate to VirtualHost /etc/httpd/conf/httpd-le-ssl.conf
Enabling site /etc/httpd/conf/httpd-le-ssl.conf by adding Include to root configuration

Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2
Redirecting vhost in /etc/httpd/conf/httpd.conf to ssl vhost in /etc/httpd/conf/httpd-le-ssl.conf

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled https://i.dongde.com

3

VirtualHost configuration:
*:80                   i.dongde.com (/etc/httpd/conf/httpd.conf:44)
*:443                  is a NameVirtualHost
         default server i.dongde.com (/etc/httpd/conf.d/ssl.conf:56)
         port 443 namevhost i.dongde.com (/etc/httpd/conf.d/ssl.conf:56)
         port 443 namevhost i.dongde.com (/etc/httpd/conf/httpd-le-ssl.conf:2)
ServerRoot: "/etc/httpd"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/etc/httpd/logs/error_log"
Mutex authdigest-opaque: using_defaults
Mutex proxy-balancer-shm: using_defaults
Mutex rewrite-map: using_defaults
Mutex authdigest-client: using_defaults
Mutex ssl-stapling: using_defaults
Mutex proxy: using_defaults
Mutex authn-socache: using_defaults
Mutex ssl-cache: using_defaults
Mutex default: dir="/run/httpd/" mechanism=default
Mutex mpm-accept: using_defaults
PidFile: "/run/httpd/httpd.pid"
Define: _RH_HAS_HTTPPROTOCOLOPTIONS
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="apache" id=48
Group: name="apache" id=48

Thanks a lot

1 Like

Hi @jimmymcgill

there

you see the problem: You have two vHosts, so the wrong vHost with a self signed certificate is used.

Merge both vHosts in one. Or disable both and let Certbot reinstall the certificate:

certbot --reinstall -i apache -d i.dongde.com
1 Like

Thank you sir, you made my day.

I comment out some other ssl.conf file include line form the main conf(httpd.conf)

and reinstalled the certificate and hooray!

Thanks again.

2 Likes

It seems that your ssl.conf is conflicting with httpd-le-ssl.conf.

Apache will always choose the first of multiple matches.

Try renaming the ssl.conf file.

Like:

mv /etc/httpd/conf/ssl.conf /etc/httpd/conf/zzz-ssl.conf

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.