ACME SSL là việc ứng dụng giao thức ACME (Automated Certificate Management Environment) để tự động hóa quy trình cấp phát, xác thực, gia hạn và thu hồi chứng chỉ SSL/TLS cho tên miền website mà không cần can thiệp thủ công, bài viết này sẽ hướng dẫn cài đặt ACME cho website sử dụng Apache hoặc Nginx.
1. Tải certbot #
1.1 Debian OS
- Update package
sudo apt update
- Tải certbot
#Apache
sudo apt install certbot python3-certbot-apache
#Nginx
sudo apt install certbot python3-certbot-nginx
1.2 Red Hat OS
- Tải EPEL repository
sudo dnf install epel-release
- Refresh danh sách repository
sudo dnf clean all
sudo dnf update
- Tải certbot
#Apache
sudo dnf install certbot python3-certbot-apache
#Nginx
sudo dnf install certbot python3-certbot-nginx
2. Cấu hình certbot (automatic mode) #
- Apache
sudo certbot --apache --non-interactive --agree-tos --server <acme-directory> --email <your-email> --eab-kid <your-eab-kid> --eab-hmac-key <your-hmac-key> --domain <your-domain> --cert-name <your-certificate-name>
- Nginx
sudo certbot --nginx --non-interactive --agree-tos --server <acme-directory> --email <your-email> --eab-kid <your-eab-kid> --eab-hmac-key <your-hmac-key> --domain <your-domain> --cert-name <your-certificate-name>
Giải thích:
--nginx / --apache: loại web server sử dụng.
--non-interactive, --agree-tos: Cho phép chạy tự động (không cần xác nhận thủ công), đồng thời tự động chấp nhận điều khoản sử dụng dịch vụ.
--server: Địa chỉ hệ thống cấp phát chứng chỉ (ACME directory) tương ứng với gói SSL đã mua.
--email: Email nhận thông báo khi chứng chỉ sắp hết hạn.
--eab-kid: Mã định danh tài khoản chứng chỉ.
--eab-hmac-key: Khóa bí mật đi kèm, dùng để xác thực tài khoản khi cấp chứng chỉ.
--domain: tên domain cần cài SSL.
--cert-name: Tên gợi nhớ để quản lý chứng chỉ trên server.
Ví dụ:
sudo certbot --nginx --non-interactive --agree-tos --email admin@vhost.vn --server https://acme.sectigo.com/v2/DV --eab-kid <your-eab-kid> --eab-hmac-key <your-hmac-key> --domain vhost.vn --domain www.vhost.vn --domain api.vhost.vn --cert-name vHost-certificate
