Bạn muốn chạy link https khi code website trên local. Cần phải sinh chứng chỉ để cài vào web server local. Tự chạy thì dùng lệnh openssl. Còn ko thì dùng tool của mình hỗ trợ cho nhanh.
http://fb.huypv.net/gencert.php?domain=botugen.local
Thay tên miền bằng tên miền local mà bạn muốn chạy https. Sau khi tải file zip về bạn giải nén thu được 2 file: .crt và .key
Cài file chứng chỉ vào trust root để trình duyệt chấp nhận chứng chỉ hợp lệ:
- Click đúp vào file .crt
- Chọn Install Certificate
- Chọn Store Location là Local Machine
- Chọn Place all certificates in the following store. Browse, chọn Trusted Root Certification Authorities. Rồi Next và Finish
Cài đặt conf cho web server, ở đây mình ví dụ là Apache XAMPP:
<VirtualHost botugen.local:443>
DocumentRoot "D:/domain/botugen.local"
ServerName botugen.local
SSLEngine on
SSLCertificateFile "conf/crt/botugen.local.crt"
SSLCertificateKeyFile "conf/crt/botugen.local.key"
<Directory "D:/domain/botugen.local">
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Tags: generate download ssl https