在Debian系统上配置LNMP(Linux, Nginx, MySQL, PHP)的SSL证书,通常需要以下几个步骤:
获取SSL证书:
安装Certbot:
sudo apt update
sudo apt install certbot python3-certbot-nginx
获取并安装SSL证书:
sudo certbot --nginx -d yourdomain.com -d www.yourdomain.com
验证配置:
sudo nginx -t
sudo systemctl reload nginx
自动续期:
sudo certbot renew --dry-run
使用Certbot获取SSL证书:
sudo certbot --nginx -d yourdomain.com -d www.yourdomain.com
Certbot会提示你输入电子邮件地址,并同意Let’s Encrypt的服务条款。然后它会自动配置Nginx并重启服务。
确保Nginx配置文件中没有错误:
sudo nginx -t
如果没有错误,重新加载Nginx服务:
sudo systemctl reload nginx
Certbot会设置一个cron任务或systemd定时器来自动续期证书。你可以手动测试续期过程:
sudo certbot renew --dry-run
如果一切正常,Certbot会自动续期证书。
通过以上步骤,你可以在Debian系统上成功配置LNMP的SSL证书。
辰迅云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
推荐阅读: debian安装及使用的方法是什么