獲取腳本nginx
git clone https://github.com/letsencrypt/letsencrypt cd ./letsencrypt
獲取證書git
#獲取證書以前,知足github
一、80端口沒有佔用web
二、你申請的域名已經指向了本機服務器IPapache
letsencrypt-auto certonly --standalone --email lihongkai1001@gamil.com -d gs-yb.haohaogamez.com
#後面會輸出證書存放路徑服務器
證書有效期默認90天 定時更新證書有效期 每個月1號 凌晨 3點執行一次網站
0 0 3 * * sh /opt/letsencrypt/letsencrypt-auto-renew.sh #/bin/sh openresty -s stop #中止nginx /opt/letsencrypt/letsencrypt-auto renew --force-renew #更新證書有效期 openresty #運行nginx
命令說明插件
run:獲取並安裝證書到當前的Web服務器rest
certonly:獲取或續期證書,可是不安裝code
renew:在證書快過時時,續期以前獲取的全部證書
-d DOMAINS:一個證書支持多個域名,用逗號分隔
--apache:使用 Apache 插件來認證和安裝證書
--standalone:運行獨立的 web server 來驗證
--nginx:使用 Nginx 插件來認證和安裝證書
--webroot:若是目標服務器已經有 web server 運行且不能關閉,能夠經過往服務器的網站根目錄放置文件的方式來驗證
--manual:經過交互式方式,或 Shell 腳本手動獲取證書