清溪雜錄
fivewillow
文章
12
分類
4
標籤
6
建站記事
為網站加上 SSL 憑証及 CDN
發佈於: 2024-2-23
最後更新: 2024-10-31
次查看
type
status
date
slug
summary
tags
category
icon
password
現在使用 Vercel 的託管服務時, 會自動加上 Let's Ecncrypt 的 SSL 憑證. 也就是說網站可以使用 https, 不用另外再申請 SSL. 但我想讓網站可以經由 CDN 傳播, 因此使用 Cloudflare 的 CDN 服務, 而它同時也有提供免費的 SSL 憑證.以下是我設定的步驟:
登入後選擇新增加網站
notion image
 
填入 domain
notion image
 
選擇免費的方案
notion image
 
把這二個 DNS 存起來, 等一下要到 Namecheap中設定.
notion image
 
進入 Namecheap 後,到 NAMESERVERS 選擇 Custom DNS. 再填入 Vercel 的 DNS
notion image
 
再回到 Cloudflare 按下 Check nameservers now
notion image
 
現在開始設定 DNS records, 如果按照之前 cname 的設定方式, 我們會得到 err_too_many_redirects 的錯誤. 這是因為 Cloudflare 到 Vercel 是使用 http, 但 Vercel 會 redirect 成 https, 然後再被 redirect 成 http.
notion image
來源: ERR_TOO_MANY_REDIRECTS · Cloudflare SSL/TLS docs
 
在參考 Vercel 提供的整合方式 後, 得知 Vercel 有提供 cname 的反向代理, 可以直接把 domain 指向到 cname.vercel-dns.com
notion image
 
記得要設定 SSL/TLS encryption mode 為 Full
notion image
 
最後,再到 Vercel 加上 domain, 就完成整個設定
notion image
 
  • 作者:fivewillow
  • 連結:https://stream-notes.fivewillows.cc/article/ssl-and-cdn-for-website
  • 著作權:本文採用 CC BY-NC-SA 4.0 許可協議,轉載請註明出處。
簡明 Linux Crontab 例行性工作排程筆記從 Vercel 綁定 Namecheap 的域名
Loading...
fivewillow
fivewillow
文章
12
分類
4
標籤
6
2024fivewillow.

清溪雜錄

Powered byNotionNext 4.7.9.