Domain & SSL
How to install a custom domain and SSL (certbot)
Rifki ahmad fahrezi
Installing a domain to a server IP and installing SSL with Certbot
Make sure you have purchased a domain name, either from Hostinger or another provider. If you buy a domain from a different provider, you must add your domain to the VPS server, here's how:
- Go to hpanel VPS hostinger, then click DNS Manager then in the add domain form enter the domain name you bought, after that a way to change the name server to hostinger will appear, (If you buy a domain from hostinger you can just skip this step)
- Log back into the VPS server, then update the Nginx config and change the IP in server_name to the domain name
Find the server_name
section then change it to `server_name your-domain.com www.your-domain.com;
- Restart Nginx
You can also check first whether the Nginx configuration file is successful or not error by running sudo nginx -t
- Install Certbot
- Create cerbot command
- Install SSL certificate
- Test automatic renewal of SSL certificate with Certbot without actually renewing the certificate, one of the purposes is to check whether the domain is still valid and can be verified by let's encrypt
After all changes to DNS are applied (can take up to 2 days, check periodically), the Nextjs website that you deployed will be available on the domain you registered along with the SSL certificate that is already actively installed