Issue HTTPS Certificates With acme.sh

《使用 acme.sh 簽發 HTTPS 證書》

請選擇進行單人副本時的難度:非常簡單

安裝

$ curl https://get.acme.sh | sh -s email=${YOUR_EMAIL}

這條命令會將 acme.sh 自動安裝到 ~/.acme.sh 下,並創建一個每天檢查證書是否即將過期的 cronjob

簽發並安裝證書

這裏從 Let's Encrypt 簽發:

$ sudo ./acme.sh --issue -d ${YOUR_DOMAIN} --standalone \
> --keylength ec-256 --server letsencrypt --force # when sudo: --force

接下來將證書安裝到提供服務的目錄下:

$ sudo ./acme.sh --installcert -d ${YOUR_DOMAIN} \
> --fullchain-file /path/to/your/directory/${YOUR_DOMAIN}.crt \ # certificate
> --key-file /path/to/your/directory/${YOUR_DOMAIN}.crt \ # encrypt key
> --reloadcmd "if needed" # reload service after renewed

實際上無論是證書還是密鑰,其文件名都是隨意的(只要提供服務的應用正確引用了就行),這裏僅僅是提供了一個方便管理的實例。