How to Configure SSL on Nginx

1.  Import your SSL to the server through FTP and unzip them in a particular directory, If you don’t have SSL you can generate Let’s Encrypt free SSL by following the below steps.

install the git package:


sudo apt-get install git


    sudo yum install git
Clone a Let’s Encrypt repository from Github Official Repository
sudo git clone /opt/letsencrypt
Navigate to the clone directory
  sudo cd /opt/letsencrypt 
Run Let’s Encrypt with the –standalone parameter. For each additional domain name requiring a certificate, add -d to the end of the command. Kindly change the domain name.
sudo -H ./letsencrypt-auto certonly --standalone -d -d
When prompted Agree to the Terms by pressing “A” and Type “N” for the second step. After this SSL will generate if all goes well you will get the below output 


– Congratulations! Your certificate and chain have been saved at:


Your key file has been saved at:


Your cert will expire on 2020-11-08. To obtain a new or tweaked

version of this certificate in the future, simply run

letsencrypt-auto again. To non-interactively renew *all* of your

certificates, run “letsencrypt-auto renew”

– If you like Certbot, please consider supporting our work by:

    Donating to ISRG / Let’s Encrypt:

Donating to EFF:          

2. Enable SSL Module

sudo a2enmod ssl

3. Create Virtual Host For SSL

server {
listen 80;
listen [::]:80;
listen 443 ssl;
listen [::]:443 ssl;
root /var/www/;
index          index.html;
ssl on; ssl_certificate /etc/nginx/ssl-certs/nginx.crt; ssl_trusted_certificate /etc/nginx/ssl-certs/nginx.crt; ssl_certificate_key /etc/nginx/ssl-certs/nginx.key; location / {
try_files $uri $uri/ =404; } }

4. Restart the nginx service and Enjoy

sudo service nginx restart

Using the above tutorial you have learned How To Configure SSL on Nginx.

100% LikesVS
0% Dislikes


  • There is significantly a bundle to understand about this. I think you made certain great factors in functions likewise. Eirena Mart Wilbur

  • It’s truly a great and helpful piece of information. I am happy that you shared
    this useful information with us. Please keep us informed like this.

    Thanks for sharing.

Comments are closed.