Install Certbot for SSL
# Install python3 virtual environment
apt install python3-venv
# Create a virtual environment
sudo python3 -m venv /opt/certbot/
# Upgrade pip
sudo /opt/certbot/bin/pip install --upgrade pip
# Using pip to install certbot & certbot-nginx
sudo /opt/certbot/bin/pip install certbot certbot-nginx
# Copy the newly install certbot package
sudo ln -s /opt/certbot/bin/certbot /usr/bin/certbot
# Instructs Certbot to use the Nginx plugin to automatically configure SSL/TLS for Nginx web servers.
sudo certbot --nginx
Add an auto certificate renew script
# Run once every 2 days
echo "0 0 */2 * * root /opt/certbot/bin/python -c 'import random; import time; time.sleep(random.random() * 3600)' && sudo certbot renew -q" | sudo tee -a /etc/crontab > /dev/null
Top comments (0)