網頁

2018/11/13

使用Let's Encrypt產生免費SSL憑證


參考文章
https://www.linode.com/docs/security/ssl/install-lets-encrypt-to-create-ssl-certificates/

通常在這步驟完成之後,會遇到一些問題

Problem binding to port 80: Could not bind to IPv4 or IPv6.

這表示port 80一直被listen。一個解決的方法是暫停NGINX server

sudo systemctl stop nginx 


然後再一次執行

sudo -H ./letsencrypt-auto certonly --standalone -d example.com -d www.example.com


如果成功了,就會看見
IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/example.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/example.com/privkey.pem

sudo systemctl restart nginx


然後回去 /etc/nginx/sites-available/example.conf, 加上ssl certificate的路徑:

    ssl_certificate      /etc/letsencrypt/live/example.com/fullchain.pem;
    ssl_certificate_key  /etc/letsencrypt/live/example.com/privkey.pem;


完成之後,記得

sudo nginx -s reload

就可以試試看https連線了!

沒有留言:

張貼留言