Trong hướng dẫn này tôi sẽ chỉ cho bạn cách cài đặt chứng chỉ ssl sử dụng .PFX file.

Chúng ta sẽ bắt đầu bằng cách giải nén tệp certificate CRT bằng  openssl  với lệnh sau:

openssl pkcs12 -in ./YOUR-PFX-FILE.pfx -clcerts -nokeys -out domain.crt

Tiếp theo là giải nén key bằng lệnh sau:

openssl pkcs12 -in ./YOUR-PFX-FILE.pfx -nodes -nocerts -out domain.key  

Giải nén Root Ca nếu cần (khi bạn gặp lỗi issuer certificate not found for certificate):

openssl pkcs12 -in ./YOUR-PFX-FILE.pfx -nodes -nokeys -cacerts -out domain-ca.crt

Gộp CA vào Cert:

cat domain-ca.crt >> domain.crt

Bây giờ chúng ta đã có thể sử dụng các file đã tạo để cài đặt và cấu hình ssl cho NGINX đơn giản nhất bằng cách config như sau:

server {
 listen 443 ssl;
 server_name domain.com domain.com;
 ssl_certificate /path/to/your/CRT_file/domain.crt;
 ssl_certificate_key /path/to/your/RSA_file/domain.rsa;

 root /mnt/coming-soon/bushbeans;
 index index.html;
 include /etc/nginx/mime.types;
}

Kiểm tra xem các config của Nginx đã được cấu hình chính xác:

nginx -t

Cấu hình tương tự với apache hoặc với các webserver khác.

Bạn có thể kiểm tra xem ssl đã được setup trên webserver của bạn chưa tại 2 link sau: https://www.ssllabs.com/ssltest/ hoặc https://www.sslshopper.com/ssl-checker.html

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted