sudo add-apt-repository ppa:certbot/certbotpython
sudo apt-get updatenginx
sudo apt-get install python-certbot-apacheapache
sudo apt-get install letsencryptbash
letsencrypt certonly --agree-tos --email youname@qq.com -d www.xxxxx.com服务器
目录,已经生成证书文件session
cert.pem: 你不用关心 (这个其实是服务器证书文件)spa
chain.pem: 你不用关心 (这个其实是… 本身看文档吧, 我没读懂. 貌似是个递归查找用的链式证书)code
fullchain.pem: cert.pem + chain.pem 的合体. 须要配置到 nginx 配置文件中的 ssl_certificate .server
privkey.pem: 私钥. 须要配置到 nginx 配置文件中的 ssl_certificate_key .递归
server {
listen 443 ssl http2;
# listen [::]:443 ssl http2;
server_name www.gabin.top;
# certs sent to the client in SERVER HELLO are concatenated in ssl_certificate
ssl_certificate /etc/letsencrypt/live/www.xxxxx.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/www.xxxxx.com/privkey.pem;
ssl_session_timeout 1d;
ssl_session_cache shared:SSL:50m;
ssl_session_tickets off;
}
复制代码
sudo letsencrypt renew