How To Secure Nginx with Let's Encrypt on Ubuntu 14.04
How To Secure Nginx with Let's Encrypt on Ubuntu 14.04
Secure your Nginx server with a free SSL certificate from Let's Encrypt on Ubuntu 14.04 with this tutorial.
Step 1: Install Certbot
First, install Certbot, a tool for obtaining and renewing SSL certificates from Let's Encrypt:
sudo apt-get update
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
sudo apt-get install python-certbot-nginx
Step 2: Configure Nginx
Edit your Nginx configuration file to enable SSL:
sudo nano /etc/nginx/sites-available/example.com
Add the following lines to the server block:
listen 443 ssl;
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 5m;
Save the file and exit.
Step 3: Obtain the SSL Certificate
Use Certbot to obtain the SSL certificate:
sudo certbot --nginx -d example.com -d www.example.com
Follow the prompts to complete the process. Certbot will automatically configure Nginx with the SSL certificate.
Step 4: Test SSL
Test your SSL configuration:
sudo nginx -t
sudo systemctl reload nginx
Visit your website using HTTPS to confirm that the SSL certificate is working.
Step 5: Automate Certificate Renewal
Let's Encrypt SSL certificates expire every 90 days. To automate the renewal process, add a cron job:
sudo crontab -e
Add the following line to the file to renew the certificate every 60 days:
0 0 */60 * * /usr/bin/certbot renew --quiet
Save the file and exit. Certbot will automatically renew the SSL certificate when it's due to expire.
Keywords: Nginx, Let's Encrypt, Ubuntu 14.04, SSL, Certbot, SSL Certificate, HTTPS, Cron job, Renewal
Комментарии
Отправить комментарий