原諒我當一次標題黨 python
網站爲何要配置 HTTPS,以及配置 HTTPS 有什麼優勢就再也不解釋了,咱們直奔主題,使用 Certbot 工具讓你的網站秒配 HTTPS 證書。nginx
Certbot is an easy-to-use client that fetches a certificate from Let’s Encrypt—an open certificate authority launched by the EFF, Mozilla, and others—and deploys it to a web server.
Certbot是由 Let’s Encrypt 一個開放免費證書頒發機構的EFF、Mozilla和其餘開發者推出的,易於客戶端獲取網站加密證書。 自嘲:英語翻譯的好爛(^o^)web
PS: 由於測試服務器站點過多,每次使用 acme-tiny 腳本配置證書都要十多分鐘時間,爲了提升效率,就使用了 Let's Encrypt 官網推薦的自動部署腳本。服務器
官方網站: https://certbot.eff.orgsession
$ sudo apt-get update $ sudo apt-get install software-properties-common $ sudo add-apt-repository ppa:certbot/certbot $ sudo apt-get update $ sudo apt-get install python-certbot-nginx
安裝成功以後把 certbot
加入系統全局變量 PATH 中。dom
service nginx stop工具
certbot certonly --standalone --email your@email.com -d yourdomain.com測試
一次生成多域名證書:fetch
certbot certonly --standalone --email your@email.com -d yourdomain.com -d yourdomain2.com網站
證書配置成功後提示:
4.查看網站生成的證書
tree /etc/letsencrypt/live/
5.配置 Nginx
…… 其餘配置 listen 443 ssl; ssl_certificate /etc/letsencrypt/live/{yourdomain}.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/{yourdomain}.com/privkey.pem; ssl_session_timeout 5m; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_prefer_server_ciphers on;
6.重啓 Nginx
service nginx start
此時再加上 https://
訪問你的網站,就會有一把可愛別緻的小綠鎖 Secure
^_^
Let’s Encrypt 生成的免費證書爲3個月時間,使用 certbot renew
能夠無限免費續簽 Https 證書
certbot renew
這是由於 nginx 服務沒有關閉,執行 service nginx stop
便可。
以爲有用是否是該點贊呢?