给网站加上免费的 HTTPS

目前更推荐的是 Caddy 服务器,一键开启 HTTPS, 自动更新。
Nginx 配置
SSL 证书
下载更新程序, 赋予执行权限,停下 nginx 服务器(生成证书需要使用 80 端口),生成证书
wget https://dl.eff.org/certbot-auto
chmod a+x certbot-auto
service nginx stop
sudo ~/certbot-auto certonly --standalone --email jaitch@163.com --agree-tos -d han.pm -d www.han.pm
自动更新
证书的默认有效期为 3 个月
service niginx stop
./certbot-auto renew
service niginx start
自动更新证书