linux centos閰嶇疆Nginx鏀寔HTTPS璁块棶 Let鈥檚 Encrypt

git鐨勫畨瑁呭氨涓嶈浜 涓鑸潵璇磍inux鏈嶅姟鍣ㄩ兘鏈
git clone https://github.com/letsencrypt/letsencrypt 浣犳墍瑕佸畨瑁呯殑鐩綍
cd 浣犳墍瑕佸畨瑁呯殑鐩綍
#瀹夎涔嬪墠瑕佸厛鏀逛竴涓媙ginx鐨勯厤缃枃浠讹紝璁╃▼搴忓彲浠ヨ繘鍏ュ埌浣犵殑鐩綍搴曚笅
 vi /usr/local/nginx/conf/nginx.conf

location ~ /.well-known {
allow all;
}
#閲嶅惎鏈嶅姟鍣
service nginx restart
# apache鐨勫懡浠ゅ簲璇ユ槸杩欎釜锛屾垜瀹夎鐨勬槸nginx
./letsencrypt-auto --apache -d example.com
#nginx
./certbot-auto certonly --webroot -w 浣犵殑缃戠珯鐩綍 -d liguoqi.site

#杩欎釜鏃跺欏簲璇ュ氨鎴愬姛浜嗭紝濡傛灉涓嶆垚鍔熺殑璇濓紝鍙兘鏄懡涓嶅ソ锛屼篃鍙兘鏄綘鐨勭綉绔欐牴鐩綍娌℃湁鏉冮檺
#鎴愬姛涔嬪悗浠栦細鍛婅瘔浣犵殑绉橀挜鍦ㄥ摢锛屽啀娆′慨鏀筺ginx閰嶇疆鏂囦欢锛屾坊鍔犱互涓嬩袱琛

ssl_certificate /etc/letsencrypt/live/liguoqi.site/fullchain.pem;
sl_certificate_key /etc/letsencrypt/live/liguoqi.site/privkey.pem;
# listen 80 鏀逛负 listen 443 ssl
# 澧炲姞浠ヤ笅鍑犲彞鍙互璁﹉ttp寮哄埗璺冲埌https
server {
        listen 80;
        server_name liguoqi.site;
        return 301 https://$host$request_uri;
}

#鏈鍚庢坊鍔犱釜瀹氭椂浠诲姟 姣忓懆缁涓涓
crontab -e

30 3 * * 1 /opt/letsencrypt/certbot-auto renew --quiet --no-self-upgrade
35 3 * * 1 /etc/init.d/nginx reload

All posts

Other pages

鍙戣〃璇勮

鐢靛瓙閭欢鍦板潃涓嶄細琚叕寮銆 蹇呭~椤瑰凡鐢*鏍囨敞