nginx+ssl

作者:iohannes 发布时间: 2025-09-01 阅读量:14

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

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

安装certbot

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

给网站自动配置ssl

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

不出意外的话,提示:

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