之前要申請免費(fèi)的 https 證書操作步驟相當(dāng)麻煩,今天看到有人在討論,就搜索了一下。發(fā)現(xiàn)現(xiàn)在申請步驟簡單多了。


1. 下載 certbot $ git clone https://github.com/c" />

国产成人精品无码青草_亚洲国产美女精品久久久久∴_欧美人与鲁交大毛片免费_国产果冻豆传媒麻婆精东

18143453325 在線咨詢 在線咨詢
18143453325 在線咨詢
所在位置: 首頁 > 營銷資訊 > 網(wǎng)站運(yùn)營 > 免費(fèi) https 證書(Let's Encrypt)申請與配置

免費(fèi) https 證書(Let's Encrypt)申請與配置

時(shí)間:2022-08-22 20:24:01 | 來源:網(wǎng)站運(yùn)營

時(shí)間:2022-08-22 20:24:01 來源:網(wǎng)站運(yùn)營

原文:免費(fèi) Https 證書(Let's Encrypt)申請與配置

之前要申請免費(fèi)的 https 證書操作步驟相當(dāng)麻煩,今天看到有人在討論,就搜索了一下。發(fā)現(xiàn)現(xiàn)在申請步驟簡單多了。


1. 下載 certbot

$ git clone https://github.com/certbot/certbot$ cd certbot$ ./certbot-auto --help解壓打開執(zhí)行就會有相關(guān)提示

2. 生成免費(fèi)證書

./certbot-auto certonly --webroot --agree-tos -v -t --email 郵箱地址 -w 網(wǎng)站根目錄 -d 網(wǎng)站域名./certbot-auto certonly --webroot --agree-tos -v -t --email keeliizhou@gmail.com -w /path/to/your/web/root -d note.crazy4code.com注意這里 默認(rèn)會自動生成 /網(wǎng)站根目錄/.well-known/acme-challenge,然后 shell 腳本會對應(yīng)的訪問 網(wǎng)站域名/.well-known/acme-challenge

比如:我的域名是note.crazy4code.com那我就得保證域名下面的.well-known/acme-challenge/目錄是可訪問的

如果返回正常就確認(rèn)了你對這個(gè)網(wǎng)站的所有權(quán),就能順利生成

3. 獲取證書

如果上面的步驟正常 shell 腳本會展示如下信息:

- Congratulations! Your certificate and chain have been saved at/etc/letsencrypt/live/網(wǎng)站域名/fullchain.pem...

4. 生成 dhparams

使用 openssl 工具生成 dhparams

openssl dhparam -out /etc/ssl/certs/dhparams.pem 2048

5. 配置 Nginx

打開 nginx server 配置文件加入如下設(shè)置:

listen 443ssl on;ssl_certificate /etc/letsencrypt/live/網(wǎng)站域名/fullchain.pem;ssl_certificate_key /etc/letsencrypt/live/網(wǎng)站域名/privkey.pem;ssl_dhparam /etc/ssl/certs/dhparams.pem;ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;ssl_ciphers HIGH:!aNULL:!MD5;然后重啟 nginx 服務(wù)就可以了

6. 強(qiáng)制跳轉(zhuǎn) https

https 默認(rèn)是監(jiān)聽 443 端口的,沒開啟 https 訪問的話一般默認(rèn)是 80 端口。如果你確定網(wǎng)站 80 端口上的站點(diǎn)都支持 https 的話加入下面的配件可以自動重定向到 https

server { listen 80; server_name your.domain.com; return 301 https://$server_name$request_uri;}

74
73
25
news

版權(quán)所有? 億企邦 1997-2022 保留一切法律許可權(quán)利。

為了最佳展示效果,本站不支持IE9及以下版本的瀏覽器,建議您使用谷歌Chrome瀏覽器。 點(diǎn)擊下載Chrome瀏覽器
關(guān)閉