วิธีทำไม่ยากเลย มาลองกันเลยดีกว่าครับ เริ่มจากเปิด Firewall ในส่วนของ HTTP และ HTTPS

sudo ufw allow 80
sudo ufw allow 443

มาติดตั้ง package หลักกันต่อเลยครับ

sudo apt install letsencrypt

หลังจากติดตั้ง letsencrypt เราสามารถเช็คสถานะ SSL certificates ด้วยคำสั่งนี้

sudo systemctl status certbot.timer

ในคำสั่งต่อไปให้เปลี่ยนคำว่า domain-name.com เป็นโดเมนที่เราต้องการจะใช้

sudo certbot certonly --standalone --agree-tos --preferred-challenges http -d domain-name.com

หากต้องการ auto renew ของ nginx ให้พิมพ์คำสั่งดังนี้

sudo apt install python3-certbot-nginx
sudo certbot --nginx --agree-tos --preferred-challenges http -d domain-name.com

หากต้องการ auto renew ของ apache ให้พิมพ์คำสั่งดังนี้

sudo apt install python3-certbot-apache
sudo certbot --apache --agree-tos --preferred-challenges http -d domain-name.com

ส่วนคำสั่งต่อไปเป็นคำสั่งสำหรับตั้งค่า Wildcard SSL certificate

sudo certbot certonly --manual --agree-tos --preferred-challenges dns -d domain-name.com -d *.domain-name.com