../
How to get SSL certificate using certbot
nginx config
- Create a dummy
nginxconfig that looks like this
server {
listen 80;
listen [::]:80;
server_name myriad.deebakkarthi.com;
location / {
root /var/www/myriadclient;
index index.html
try_files $uri $uri/ =404;
}
}
- Don’t put in any
httpsstuff here. We wantcerbotto access this site - Configure your DNS settings so that the subdomain points correct. I like to divide by projects by subdomains. I am not a fan of route based deployment. Refer this.
certbot
- Verify that your site is reachable
- Run the following command
sudo certbot certonly --webroot -d DOMAIN --webroot-path PATH
where DOMAIN may be something like app3.example.org and PATH is the root you specified in your nginx config
- For me I had to run
sudo certbot certonly --webroot -d myriad.deebakkarthi.com --webroot-path /var/www/myriadclient
- This places a folder called
.well-knownunder thatwebroot-pathand check if they are accessible - This method avoids having to pause your
nginxorapacheconfig and works smoothly - After it run take a note of where the SSL files are stored. You will need this for your
nginxconfig