If you’re trying to install an SSL on your hostname through WHM you may be encountering this error:
_get_vhost_data_structs could not fetch vhost hash
There are two common fixes for this error.
The first is simple: Make sure you hostname is a FQDN, or fully qualified domain name. That means it needs to have three parts:
subdomain.domain.tld
Without all three there are many things that can make WHM and cPanel unhappy.
The second is slightly more complicated. First, ssh into your server, and run this command:
[~]# hostname
The output that you see there should be very close to the output that you get from this command:
[~]# grep main_domain /var/cpanel/userdata/nobody/main
For example on one of our servers it looks like this:
[~]# hostname
host.encylia.com
[~]# grep main_domain /var/cpanel/userdata/nobody/main
main_domain: host.encylia.com
If you find that the contents do not match, backup that file to a different directory:
cp /var/cpanel/userdata/nobody/main /root/
and then change that line. You should then be able to add the SSL without a problem.
I did every steps you wrote. The hostname and main_domain are the same, however the error still exists… 🙁
Can you tell me if you hostname is an FQDN?
This helped me. After I changed my main_domain via nano editor, all good on SSL install. Thanks so much!
I’m so glad to hear it!
Typically you can just go into WHM > Change Hostname and click on change button (even if hostname is correct already). This will rebuild / re-validate the file is updated. Then you can proceed with applying the SSL certificate.
Unfortunately, that hasn’t been my experience. Even updating the hostname through WHM does not always correctly remove/update the /var/cpanel/userdata/nobody/main file, when you change the hostname through WHM.