Ah yes, I see what's going on. Allmost all of your other HTTPS virtualhosts on port 443 are configured as follows, with the IP address set in the <VirtualHost>
directive:
However, all of your HTTP virtualhosts on port 80 are using a wildcard (*
) in stead of an IP address:
Therefore, when certbot used the HTTP port 80 virtualhost file (/etc/httpd/sites-enabled/godzonestudy.com.conf
), it did not know of the fact that all HTTPS virtualhosts used the IP address. It just used the wildcard, as that was also used in the HTTP virtualhost. And thus you ended up having a *:443
set of virtualhosts too:
But: Apache prefers the IP:port
combination above all *:port
virtualhosts! Please see the following part of the Apache virtualhost documentation:
If multiple virtual hosts contain the best matching IP address and port, the server selects from these virtual hosts the best match based on the requested hostname. If no matching name-based virtual host is found, then the first listed virtual host that matched the IP address will be used. As a consequence, the first listed virtual host for a given IP address and port combination is the default virtual host for that IP and port combination.
That means that Apache does not even consider using your "port 443 namevhost www.godzonestudy.com"! Because it has matching IP:port
virtualhosts! It does not matter in that case that it can't find a virtualhost with ServerName
"www.godzonestudy.com". Because it can match the IP address and port to the 159.89.173.97:443
NameVirtualHost, but not find the actual hostname, it will use the default server of the 159.89.173.97:443
NameVirtualHost. In this case your Apache sends an expired certificate for adoxglobal.com
, not sure why that's the case, but for the hostname currently at issue, the above is the explanation.
Now for the solution(s), there are three:
Either change all <VirtualHost 159.89.173.97:443>
to <VirtualHost *:443>
or
Change all <VirtualHost *:80>
to <VirtualHost 159.89.173.97:80>
(but only if those virtualhosts actually use that IP address of course) and try to install the certificate again with the command I just gave you. You'll probably need to delete the file generated by certbot /etc/httpd/sites-available/godzonestudy.com-le-ssl.conf
before you try to install it again.
My preference for servers with just a single IP address: just use *:80
and *:443
. Using IP:port
is only usefull if you have multiple IP addresses and are using those IP address to select virtualhosts.
The third option is to manually edit the configuration file generated by certbot /etc/httpd/sites-available/godzonestudy.com-le-ssl.conf
and change <VirtualHost *:443>
to <VirtualHost 159.89.173.97:443>
. But if you only change that file, you'll run into the same issue again if you try to get a certificate for a different hostname with certbot.