Thuta Learning

Custom Domain နှင့် HTTPS ချိတ်ဆက်နည်း

Domain DNS record များကိုနားလည်ပြီး hosting service သို့ချိတ်ဆက်ခြင်း၊ HTTPS certificate အတည်ပြုခြင်းနှင့် redirect စစ်ဆေးခြင်းတို့လုပ်ပါမယ်။

Custom Domain နှင့် HTTPS ချိတ်ဆက်နည်း cover illustration

Problem

DNS record မှားခြင်း၊ record နှစ်ခုတိုက်ခြင်းနှင့် www/non-www redirect မသတ်မှတ်ခြင်းကြောင့် site မဖွင့်နိုင်ခြင်း သို့မဟုတ် certificate error ဖြစ်တတ်ပါတယ်။

Requirements

  • ကိုယ်ပိုင် domain
  • DNS provider သို့ဝင်ခွင့်
  • Deploy ပြီးသော website

Canonical domain ကိုရွေးပါ

example.com သို့မဟုတ် www.example.com တစ်ခုကို canonical အဖြစ်ရွေးပါ။ နှစ်ခုလုံးအသုံးပြုနိုင်ပေမယ့် တစ်ခုကိုအဓိကထားပြီး နောက်တစ်ခုက permanent redirect လုပ်ရပါမယ်။

Hosting provider အကြံပြုသော DNS record ထည့်ပါ

Provider dashboard မှာ domain ကိုအရင်ထည့်ပြီး ပြသထားတဲ့ A၊ AAAA သို့မဟုတ် CNAME record ကို DNS provider မှာကူးထည့်ပါ။ အဟောင်း record တူနေပါက conflict မဖြစ်အောင်စစ်ပါ။

DNS propagation ကိုစစ်ပါ

DNS update ကချက်ချင်းမပေါ်နိုင်ပါ။ Public resolver က record အသစ်ကိုမြင်ပြီလားစစ်ပြီး cache သက်တမ်းကုန်ရန်စောင့်ပါ။ Record ကိုမကြာခဏပြောင်းတာက troubleshooting ကိုပိုခက်စေပါတယ်။

Terminal
> nslookup example.com
> nslookup www.example.com

HTTPS နှင့် redirects စစ်ပါ

Hosting provider certificate ထုတ်ပြီးချိန်မှာ http URL က https သို့ပြောင်းသလား၊ www နဲ့ apex domain က canonical တစ်ခုဆီရောက်သလား စစ်ပါ။ Browser certificate warning မရှိရပါဘူး။

Terminal
$ curl -I http://example.com
$ curl -I https://www.example.com

Expected result

Canonical redirect ရှိပြီး HTTPS certificate မှန်ကန်သော custom domain ဖြင့် site ကိုဖွင့်နိုင်ပါမယ်။

Troubleshooting

  • NXDOMAIN ဖြစ်လျှင် nameserver နဲ့ record host ကိုစစ်ပါ။
  • Certificate pending ဖြစ်လျှင် DNS record propagation နှင့် CAA record ကိုစစ်ပါ။
  • Redirect loop ဖြစ်လျှင် hosting redirect နဲ့ proxy redirect နှစ်ခုပြိုင်နေခြင်းရှိမရှိစစ်ပါ။

Related tutorials