自從google開始在2014年起推行了https everywhere的口號,並在搜索排名中把有https的SEO排前,現在所有的網路連線幾乎可以是沒有https不行了,尤其連遊覽器都鄙視http時,怎麼做ssl已經是必要技能了。
還好,Let’s Encrypt推出來免費的ssl的服務,造福我們這種沒錢買ssl認證的平民老百姓啊,現在就來看一下怎麼簡單做到ssl認證,並自可以自動更新憑證吧!
首先安裝certbot,先到CertBot選擇作業系統跟http服務器
以下是nginx + debain 8的範例
1 |
sudo apt-get install certbot -t jessie-backports |
裝好後,就可以開始certify 你的網址了
1 2 3 4 5 |
sudo certbot certonly sudo certbot certonly --webroot -w /var/www/example -d example.com -d www.example.com -w /var/www/thing -d thing.is -d m.thing.is sudo certbot certonly --standalone -d example.com -d www.example.com //用standalone的話,需要暫停你的http服務器 sudo certbot renew --dry-run //測試認證 certbot renew //設在sudo user的crontab裏定時更新憑證 |
現在做ssl的https認證加密就是這麼簡單啦,Certbot連nginx裏的設定檔都會幫你改好,還會詢問是否全部轉向https等等選項,就看自己需求了!