Generate free ssl for nginx on sslforfree site


Step 1: Enter sslforfree Enter the domain name and select next



Figure 1: Enter domain


Step 2: Choose 3 months for free ssl and choose next



Figure 2: Choose a time


Step 3: Go to the page csrgenerator Enter the necessary information to generate the key and csr



Figure 3: Generate key and csr


Step 4: Paste csr in to generate ssl and choose next step



Figure 4: Paste CSR


Step 5: Choose the next step



Figure 5: choose next


Step 6: Choose ssl authentication type (here I choose dns to create a CNAME record on the domain)



Figure 6: Choosing an authentication type


Step 7: Go to the domain management section to create records



Figure 7: Creating a record


Step 8: After creating the record, click validate domain



Figure 8: Authentication


Step 9: After the authentication is complete, download the ssl . installation file



Figure 9: download the installation file


Step 10: Install the necessary libraries with the command


yum install yum-utils -y



Figure 10: Installation command


Step 11: Install nginx using the command


yum install nginx -y



Figure 11: The nginx . install command


Step 12 : Turn on nginx running at server start up , run nginx , check nginx running with the commands


systemctl enablenginx


systemctl start nginx


systemctl status nginx  



Figure 12: Running nginx


Step 13: Go to the website to check



Figure 13: Check nginx web is running


Step 14: Command to file conf


Vi /etc/nginx/conf.d/vdata.cf.conf



Figure 14: Go to the config file


Step 15: add to the conf . file


server{


  listen 80;


  server_name www.vdata.cf vdata.cf;


  access_log /home/vdata.cf/logs/access.log;


  error_log /home/vdata.cf/logs/.error.log;


  root /home/vdata.cf/public_html;


  index index.html index.htm index.php;


}



Figure 15: Adding commands


Step 16: create the file, give permissions and run nginx again with the command


mkdir -p /home/domain/public_html


mkdir -p /home/domain/logs


chown -R nginx:nginx /home/domain


systemctl reload nginx



Figure 16: Commands to create directories, permissions, and reload nginx


Step 17: Create a web file and add text to the file


touch /home/domain/public_html/index.html


echo text >> /home/domain/public_html/index.html



Figure 17: Command to create index file and insert text


Step 18: Create ssl folder and copy ssl file


sudo mkdir /etc/nginx/ssl



Figure 18: ssl . directory command


Step 19: enter the conf file with the command


vi /etc/nginx/conf.d/default.conf



Figure 19: Command to enter the conf . file


Step 20: Add to the conf . file


server {


   listen 80;


   return 301 https://$host$request_uri;


}


server {


    listen 443;


    server_name domain;


    ssl_certificate /etc/nginx/ssl/cert.crt;


    ssl_certificate_key /etc/nginx/ssl/cert.key;



    ssl on;


    ssl_session_cache builtin:1000 shared:SSL:10m;


    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;


    ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;


    ssl_prefer_server_ciphers on;


}



Figure 20: Commands in the conf . file


Step 21: Restart nginx service with command


service nginx restart



Figure 21: The command restart nginx


Step 22: Then go to https://domain check



Figure 21: Checking existing ssl


Conclusion


So we have just completed the steps to install free ssl on nginx here we can install ssl for our server for free, also you can refer to the bkns ssl package to stabilize your website


Thank you for reading this article!


Baby Snake


0 Comments