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