/
Nginx setup with ssl:

Nginx setup with ssl:

  1. Generate certificate from:

https://punchsalad.com/ssl-certificate-generator/

generate-ssl-cert.png

 

  1. Update DNS record , wait for 5 mins and check the dns ex:

update-dns-record-ssl2.png

 

  1. Once record is verified , download the cert from next page

download-ssl-cert.png

 

  1. rename the files accordingly

sudo mv your_domain_chain-CA.txt your_domain_chain.crt sudo mv your_private-key.txt your_private.key
  1. Install nginx

sudo apt update sudo apt install nginx
  1. create directory to store ssl certs and copy the downloaded cert files in Step 4

sudo mkdir /etc/nginx/certs
  1. Create a nginx configuration file

vi /etc/nginx/sites-available/mysite.conf
server { listen 80; server_name $domainname; # update this return 301 https://$server_name$request_uri; #redirect to https } } server { listen 443 ssl; ssl_certificate /etc/nginx/certs/your_domain_chain.crt; # update this ssl_certificate_key /etc/nginx/certs/your_private.key; # update this server_name your_domain.com; # update this location / { proxy_pass http://localhost:8080; } }
  1. Create symlink

sudo ln -s /etc/nginx/sites-available/dev-allbot.conf /etc/nginx/sites-enabled/
  1. check configuration and reload nginx

sudo nginx -t && sudo nginx -s reload

 

Related content