Skip to content
nginx+ssl
2025年9月1日 root

确保nginx和http网站已经配置好了

bash
sudo service nginx status
curl http://www.yourdomain.com

安装certbot

bash
sudo apt update
sudo apt install certbot python3-certbot-nginx

给网站自动配置ssl

bash
sudo certbot --nginx -d yourdomain.com -d www.yourdomain.com

不出意外的话,提示:

txt
Successfully deployed certificate for yourdomain.com to /etc/nginx/sites-enabled/default
Successfully deployed certificate for www.yourdomain.com to /etc/nginx/conf.d/iohannes.conf
Congratulations! You have successfully enabled HTTPS on https://yourdomain.com and https://www.yourdomain.com

Last updated: