How to setup SSL Certificate in Nginx on Ubuntu 20.04

Date: 24-07-2021

Step 1: Once your certificate request is approved, you can download your SSL and intermediate certificates.

Step 2: Login to your server via SSH.

Step 3: Create a directory like below and upload the downloaded the private key, certificate and intermediate bundle files by using SFTP or SSH.
# sudo mkdir /etc/nginx/ssl

Step 4: Navigate to the SSL folder.
# cd /etc/nginx/ssl

Step 5: Combine your SSL certificate and the intermediate bundle into one file. You can use below command.
# sudo cat f84e111a2f44c1106.crt gd_bundle-g2-g1.crt >> domainname.crt

Step 6: Update below lines in the Nginx config file under the 443 section to use the SSL certificate.
=====
ssl_certificate /etc/nginx/ssl/domainname.crt;
ssl_certificate_key /etc/nginx/ssl/domainname.key;

=====
Note: domainname.key – Private key
domainname.crt – Combined certificate file

Step 7: Restart the Nginx service.
# nginx -t
# systemctl restart nginx
# systemctl status nginx

Your SSL Certificate is installed. You can verify this in your browser.

Thank you!

Leave a Reply