要先找一個可使用的域名,我從https://www.noip.com/這裡申請帳號後可設定域名,進入帳號設定中選擇Dynamic DNS並新增Hostname

不過要記得30天內更新,否則會失效。

再來設定路由器,我使用的是DrayTek VigorFly210

然後要記得開port,這樣在申請SSL才能通過

在安裝前先參考這篇,安裝一些優先套件,然後要安裝Certbot來取得certificate

yum --enablerepo=epel -y install certbot
certbot certonly --webroot -w /var/www/html -d [這裡輸入申請的DomainName]
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator webroot, Installer None
Enter email address (used for urgent renewal and security notices)
 (Enter 'c' to cancel): [root@DomainName]
Starting new HTTPS connection (1): acme-v02.api.letsencrypt.org
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server at
https://acme-v02.api.letsencrypt.org/directory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(A)gree/(C)ancel: A

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing, once your first certificate is successfully issued, to
share your email address with the Electronic Frontier Foundation, a founding
partner of the Let's Encrypt project and the non-profit organization that
develops Certbot? We'd like to send you email about our work encrypting the web,
EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: Y
Starting new HTTPS connection (1): acme-v02.api.letsencrypt.org
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for [DomainName]
Using the webroot path /var/www/html for all unmatched domains.
Waiting for verification...
Cleaning up challenges
Subscribe to the EFF mailing list (email: [root@DomainName]).
Starting new HTTPS connection (1): supporters.eff.org
IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/(FQDN)/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/(FQDN)/privkey.pem
   Your cert will expire on 2021-01-17. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot
   again. To non-interactively renew *all* of your certificates, run
   "certbot renew"
 - If you like Certbot, please consider supporting our work by:

   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le

證書的有效期限為90天,在剩餘30天之前需要更新證書

certbot renew

如果超過則要加上參數[–force-renew]