📅  最后修改于: 2023-12-03 14:59:54.754000             🧑  作者: Mango
Certbot is a free, open-source software tool used to automate the process of obtaining and renewing SSL/TLS certificates. In this tutorial, we will focus on using Certbot with the Nginx web server to obtain a certificate and configure SSL encryption for a website.
Before we begin, ensure that you have:
To install Certbot, run the following commands:
sudo apt-get update
sudo apt-get install certbot python3-certbot-nginx
To obtain a certificate for your domain, run the following command:
sudo certbot --nginx certonly -d yourdomain.com
This will initiate the certificate issuance process for the specified domain. You will need to follow the prompts and provide the requested information.
After obtaining the certificate, you need to configure Nginx to use it. You can do this by updating the SSL configuration file at /etc/nginx/sites-available/yourdomain.com
with the following lines:
listen 443 ssl;
ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem;
Restart Nginx to apply the changes:
sudo systemctl restart nginx
Congratulations! You now have an SSL/TLS certificate installed on your Nginx web server. Certbot has greatly simplified the process of obtaining and renewing SSL/TLS certificates, making it easier than ever to secure your websites.