ทำการ install certbot ด้วยคำสั่ง
sudo snap install --classic certbot
sudo apt-get update
sudo apt-get install python3-certbot-nginx
หลังทำการเพิ่ม subdomain เข้าไปใน A record ของ DNS แล้ว ให้ทำการเพิ่ม script ดังต่อไปนี้เข้าไปใน nginx server file
server {
listen 80;
listen [::]:80;
server_name subdoamin.domain.com;
location / {
proxy_set_header X-Forwarded-Proto https;
proxy_pass http://localhost:3000;
}
}
เสร็จแล้วให้ทำการ restart nginx และ confgire certbot ด้วยคำสั่ง
sudo certbot --nginx -d subdomain.domain.com -d www.subdomain.domain.com
ตามด้วยคำสั่ง
certbot renew --dry-run
เพื่อให้ certbot ต่ออายุ ssl ให้อัตโนมัติเมื่อหมดอายุ (90 วัน)
No comments:
Post a Comment