รวมไฟล์ Leaf Certificate และ Intermediate CA เป็น Fullchain
NGINX ไม่ได้แยก Directive สำหรับ Intermediate CA ออกจากใบรับรองหลัก จึงต้องนำไฟล์ใบรับรองโดเมนมาต่อด้านบนสุด ตามด้วยไฟล์ Intermediate CA Bundle ตามลำดับที่ถูกต้อง
- ห้ามนำ Root CA มาต่อท้ายโดยไม่จำเป็น และห้ามสลับลำดับให้ Intermediate ขึ้นก่อน Leaf Certificate
- ล็อกสิทธิ์ไฟล์ Private Key ด้วย chmod 600 เพื่อป้องกันผู้ใช้ทั่วไปบนระบบอ่านข้อมูลกุญแจลับ
sudo mkdir -p /etc/nginx/ssl
# ลำดับที่ถูกต้อง: Leaf Certificate อยู่บน ตามด้วย Intermediate CA Bundle
cat example_co_th.crt intermediate_ca_bundle.crt | sudo tee /etc/nginx/ssl/fullchain.pem > /dev/null
# ย้าย Private Key และตั้งสิทธิ์อ่านเฉพาะ root
sudo cp example_co_th.key /etc/nginx/ssl/example_co_th.key
sudo chmod 600 /etc/nginx/ssl/example_co_th.key
sudo chown root:root /etc/nginx/ssl/example_co_th.key