While CyberPanel provides you an opportunity to automatically issue an SSL certificate, it is necessary that the domain is pointing to the VPS by nameservers first - no worries as we'll cover it in detail, just follow these steps:
Step 1 - Preparations
Before installing the SSL, make sure that:
The VPS has CyberPanel installed and updated, and the dashboard is accessible
The domain is added to CyberPanel and is not used elsewhere
Step 2- Create Nameservers and Point Domain
On CyberPanel, go to DNS → Create nameserver:
Next, fill in the form with the following:
Domain name - your domain name
First Nameserver - create a name for your first nameserver, such as ns1.domain.tld (where domain.tld is your domain name)
IP Address - Your VPS IP address
Second nameserver - create a name for your second nameserver, for example, ns2.domain.tld
IP Address - Enter again your VPS IP address
Once done, click Create Nameserver to save the changes:
Now, set up these nameservers as child nameservers to point your domain to your VPS. If your domain is purchased at Hostinger, you can do so from hPanel following this guide: How to create child nameservers.
Use the following values for the child nameservers:
Child nameserver 1 and 2 - the nameservers created in the previous step
IPv4 address - your VPS IP address
Wait up to 24 hours for propagation to complete and after that, the domain's DNS zone will be managed from CyberPanel and you will be able to install the SSL 😊
NOTE
If your domain is purchased elsewhere you will need to set up the child nameservers there. To manage your domain and VPS in one place, you can transfer your domain to Hostinger
Step 3 - Issue SSL Certificate
Once your domain is fully propagated, you can install the SSL and force HTTPS. On your main CyberPanel page, go to SSL → Manage SSL:
Choose the domain name and click on Issue SSL:
To force HTTPS for your website, go back to the Available functions section and click on Websites:
Next, click on List Website, locate your domain and click Manage:
Scroll down to the Configurations area and click on Rewrite Rules:
Click on the dropdown list and select Force HTTP → HTTPS:
Click on Save Rewrite Rules to save the changes. That's it! The SSL is issued and a secure connection is forced. You can now visit your website on an incognito window to verify that SSL is properly installed and working 😊
NOTES
The issued SSL Certificate is from Let's Encrypt and is valid for 90 days. After the certificate expired, you will need to re-issue it
Installing an SSL while the domain is still propagating will create a self-signed certificate, which may cause errors when accessing your website
If you encounter any issues while installing SSL, check this article on how to fix SSL issues on CyberPanel VPS