FREE SSL ON NGINX WEBSITE


Requirements

  1. A domain. Like -example.com
  2. You can purchase a domain name on Namecheap, GoDaddy, etc.
  3. On domain server, add A record with example.com pointing to your server’s public IP address.
  4. Install Nginx, in server-
Step 1 — Installing Certbot

You should Encrypt to acquire an SSL certificate, connect the Certbot software on your server.

# sudo add-apt-repository ppa:certbot/certbot
# sudo apt-get update
# sudo apt-get install python-certbot-nginx

Certbot is now ready to use.

Step 2 — Setting up Nginx Config

On server-
Go to
# cd /etc/nginx/sites-available/
# ll

Setting up Nginx Config  - Free SSL On Nginx Website


Copy a default and past the same with your domain name.
# cp -r default example.com


# vim example.com
Delete all the things and add the following line and save this file
For save a file (press Esc then:wq! then enter) It will save files. If you don't want to save this file then (press Esc then:q! Then enter).

server {

       server_name example.com;

       root /var/www/html/;


       location / {
              access_log off;
                proxy_pass http://127.0.0.1;

                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header Host $host;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
       }
}

Setting up Nginx Config  - Free SSL On Nginx Website



Then, verify the syntax of your configuration edits


# sudo nginx -t

If you see any failures, review the document, and check for errors, at that point test it once more. Once your configuration’s syntax is accurate, reload Nginx to stack the new configuration.

# sudo systemctl reload nginx
Or
# sudo /etc/intd.d/nginx restart

If you have the ufw firewall empowered, as recommended by the prerequisite guides, you’ll have to alter the settings to consider HTTPS traffic. You likewise can off your ufw.
# sudo ufw status

Step 4 — Installation an SSL Certificate

# sudo certbot --nginx -d example.com

This runs certbot with the --nginx plugin, relating -d to define the names we’d like the certificate to be substantial for. If this is your first time running certbot, you will be proposed to enter an email address and consent to the terms of service. Subsequent to doing as such, certbot will interact with the Let’s Encrypt server, then run a test to verify that you control the domain you’re inquiring a certificate for. If that’s successful, certbot will ask how you’d prefer to configure your HTTPS settings.
Installation an SSL Certificate - Free SSL On Nginx Website



Select your choice then hit ENTER. The configuration will be refreshed, and Nginx will reload to get the new settings. certbot will wrap up with a message revealing to you the procedure was effective and where your certificates are put away:

Installation an SSL Certificate - Free SSL On Nginx Website


Your certificates are downloaded, installed, and loaded. Try reloading your website applying https:// and see your browser’s security sign. It should indicate that the site is well secured.

Step 5 — Certbot Auto-Renewal

Let’s Encrypt’s certificates are just legitimate for ninety days. This is to assist users to automate their certificate regeneration method.

# sudo certbot renew --dry-run

If you see no errors, you’re all set.

Previous
Next Post »

2 comments

Click here for comments
simsyalde
admin
29 May 2020 at 09:59 ×

Very much informative

Reply
avatar