certbot 命令生成免费ssl证书
Let's Encrypt免费证书申请
1.安装certbot
2.域名解析
3.certbot certonly --standalone --agree-tos --register-unsafely-without-email -d www.ixiaocui.com
- -d 参数指定域名,可多个。
- standalone 参数certbot生成证书需要鉴权,使用这种方式鉴权需停掉nginx,certbot占用80端口
// 生成的证书在/etc/letsencrypt/live/
4.配置Nginx
server {
listen 443;
server_name www.ixiaocui.world;
ssl on;
ssl_certificate /etc/letsencrypt/live/www.ixiaocui.world/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/www.ixiaocui.world/privkey.pem;
location / {
proxy_pass http://localhost:3000;
}
}
5.重启Nginx
6.证书好像只有三个月的有效期,可以设置crontab执行