Trong bài viết này sẽ sử dụng tên miền ảo làm ví dụ là site.test
Nội dung chính
- 1. Vào thư mục Apache trong XAMPP.
- 2. Tạo một thư mục mới.
- 3. Tải về và thêm 2 tập tin này vào thư mục vừa tạo
- 4. Sửa cert.conf và chạy make-cert.bat
- 5. Cài đặt chứng chỉ trong windows.
- 6. Thêm trang web trong máy chủ Windows
- 7. Thêm tên miền này vào file conf của XAMPP.
- 8. Khởi động lại trình duyệt và thử lại!
- Description
- Return Values
1. Vào thư mục Apache trong XAMPP.
2. Tạo một thư mục mới.XAMPP đợc cài đặt trong thư mục C:\xampp\apache.
2. Tạo một thư mục mới.
3. Tải về và thêm 2 tập tin này vào thư mục vừa tạocrt ,Vì vậy, đường dẫn sẽ có dạng C:\xampp\apache\crt
3. Tải về và thêm 2 tập tin này vào thư mục vừa tạo
4. Sửa cert.conf và chạy make-cert.batcert.conf make-cert.bat về. 2 tập tin này sẽ dùng để tạo chứng chỉ SSL cho tên miền tùy thích.
4. Sửa cert.conf và chạy make-cert.bat
5. Cài đặt chứng chỉ trong windows.site.test và lưu lại.
6. Thêm trang web trong máy chủ Windowssite.test khi được nhắc. Và nhập trả lời cho các câu hỏi khác, thiết lập mặc định có sẵn trong cert.conf
5. Cài đặt chứng chỉ trong windows.
6. Thêm trang web trong máy chủ Windowsserver.crt and server.key. Đây là chứng chỉ SSL certificate.
7. Thêm tên miền này vào file conf của XAMPP.
8. Khởi động lại trình duyệt và thử lại!Local Machine trong Store Location.
DescriptionPlace all certificate in the following store” và click browse sau đó chọn Trusted Root Certification Authorities.
Return ValuesNext và Finish.
Mặc định XAMPP đợc cài đặt trong thư mục C:\xampp\apache.
6. Thêm trang web trong máy chủ Windows
- 7. Thêm tên miền này vào file conf của XAMPP.
- 8. Khởi động lại trình duyệt và thử lại!
- Description
127.0.0.1 site.test
Return Values
7. Thêm tên miền này vào file conf của XAMPP.
8. Khởi động lại trình duyệt và thử lại!C:\xampp\apache\conf\extra\httpd-xampp.conf
Description
## site.test DocumentRoot "C:/xampp/htdocs" ServerName site.test ServerAlias *.site.test DocumentRoot "C:/xampp/htdocs" ServerName site.test ServerAlias *.site.test SSLEngine on SSLCertificateFile "crt/site.test/server.crt" SSLCertificateKeyFile "crt/site.test/server.key"
Return Values
Mặc định XAMPP đợc cài đặt trong thư mục C:\xampp\apache.: Trong file conf XAMPP, bạn có thể thay đổi thư mục gốc cho từng tên miền nếu cần.
8. Khởi động lại trình duyệt và thử lại!
Description
Return Values
Mặc định XAMPP đợc cài đặt trong thư mục C:\xampp\apache.
Đây là nơi ta sẽ lưu trữ chứng chỉ SSL. Trong ví dụ này Ngôi Sao Số sẽ tạo thư mục crt ,Vì vậy, đường dẫn sẽ có dạng C:\xampp\apache\crt — Generates a CSR
Description
Return Values: You need to have a valid openssl.cnf installed for this function to operate correctly. See the notes under the installation section for more information.
Mặc định XAMPP đợc cài đặt trong thư mục C:\xampp\apache.
Đây là nơi ta sẽ lưu trữ chứng chỉ SSL. Trong ví dụ này Ngôi Sao Số sẽ tạo thư mục crt ,Vì vậy, đường dẫn sẽ có dạng C:\xampp\apache\crtVào đường dẫn sau tải 2 tập tin cert.conf make-cert.bat về. 2 tập tin này sẽ dùng để tạo chứng chỉ SSL cho tên miền tùy thích.
Mở file cert.conf và thay đổi {{DOMAIN}} thành tên miền bạn muốn, trong trường hợp này site.test và lưu lại.Nhấp đúp chuột vào make-cert.bat và nhập tên miền site.test khi được nhắc. Và nhập trả lời cho các câu hỏi khác, thiết lập mặc định có sẵn trong cert.confopenssl_pkey_new[] [or otherwise obtained from the other openssl_pkey family of functions]. The corresponding public portion of the key will be used to sign the CSR.
Sau đó, bạn sẽ thấy thư mục site.test được tạo. Trong thư mục đó ta sẽ có server.crt and server.key. Đây là chứng chỉ SSL certificate.Nhấp đúp chuột vào server.crt để cài đặt nó trên Windows để Windows chấp nhận chứng chỉ này.
Và chọn Local Machine trong Store Location.Sửa C:\Windows\System32\drivers\etc\hosts | Thêm một dòng mới: | Điều này sẽ giúp XAMPP khi truy cập //site.test sẽ trỏ tên miền này về IP localhost | Giờ bạn cần kích hoạt SSL cho tên miền này và cho XAMPP biết nơi lưu trữ Chứng chỉ SSL. Vì vậy, bạn cần chỉnh sửa C:\xampp\apache\conf\extra\httpd-xampp.confopenssl_get_md_methods[] |
Và thêm dòng mới này dưới cùng: | Thêm một dòng mới: | Và thêm dòng mới này dưới cùng: | Sau đó, bạn sẽ cần khởi động lại Apache trong XAMPP. Đơn giản, chỉ cần mở Bảng điều khiển XAMPP và bấm stop và start tại mục Apache. |
Mẹo: Trong file conf XAMPP, bạn có thể thay đổi thư mục gốc cho từng tên miền nếu cần. | Thêm một dòng mới: | Mẹo: Trong file conf XAMPP, bạn có thể thay đổi thư mục gốc cho từng tên miền nếu cần. | Cần khởi động lại trình duyệt để hệ thống tải chứng chỉ. Và truy cập tên miền trên trình duyệt của bạn, và bạn sẽ thấy khóa màu xanh lá như hình bên dưới! |
Ngôi Sao Số hy vọng hướng dẫn này hữu ích! | int | [PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8] | openssl_csr_new — Generates a CSR |
Note: You need to have a valid openssl.cnf installed for this function to operate correctly. See the notes under the installation section for more information. | int | Parameters | distinguished_names 5, 6, 7 or 8. The default value is 7.
|
The Distinguished Name or subject fields to be used in the certificate. | private_key
| The Distinguished Name or subject fields to be used in the certificate. | private_key |
Encrypt_key_codes | int | không ai | Một trong những hằng số mật mã. |
đường cong_name | sợi dây | không ai | Một trong những hằng số mật mã.openssl_get_curve_names[]. |
đường cong_name | sợi dây | Một trong các openSSL_GET_CURVE_NAME []. | Cấu hình |
Đường dẫn đến tệp OpenSSL.conf thay thế của riêng bạn.
## site.test
DocumentRoot "C:/xampp/htdocs"
ServerName site.test
ServerAlias *.site.test
DocumentRoot "C:/xampp/htdocs"
ServerName site.test
ServerAlias *.site.test
SSLEngine on
SSLCertificateFile "crt/site.test/server.crt"
SSLCertificateKeyFile "crt/site.test/server.key"
0
## site.test DocumentRoot "C:/xampp/htdocs" ServerName site.test ServerAlias *.site.test DocumentRoot "C:/xampp/htdocs" ServerName site.test ServerAlias *.site.test SSLEngine on SSLCertificateFile "crt/site.test/server.crt" SSLCertificateKeyFile "crt/site.test/server.key"0 được sử dụng để chỉ định các tùy chọn cấu hình bổ sung cho CSR. Cả
distinguished_names
và ## site.test DocumentRoot "C:/xampp/htdocs" ServerName site.test ServerAlias *.site.test DocumentRoot "C:/xampp/htdocs" ServerName site.test ServerAlias *.site.test SSLEngine on SSLCertificateFile "crt/site.test/server.crt" SSLCertificateKeyFile "crt/site.test/server.key"0 đều là các mảng kết hợp có các khóa được chuyển đổi thành OID và áp dụng cho phần liên quan của yêu cầu.
## site.test DocumentRoot "C:/xampp/htdocs" ServerName site.test ServerAlias *.site.test DocumentRoot "C:/xampp/htdocs" ServerName site.test ServerAlias *.site.test SSLEngine on SSLCertificateFile "crt/site.test/server.crt" SSLCertificateKeyFile "crt/site.test/server.key"4 on failure.
Trả về giá trị
8.0.0 | Phiên bảnOpenSSLCertificateSigningRequest instance now; previously, a resource of type ## site.test DocumentRoot "C:/xampp/htdocs" ServerName site.test ServerAlias *.site.test DocumentRoot "C:/xampp/htdocs" ServerName site.test ServerAlias *.site.test SSLEngine on SSLCertificateFile "crt/site.test/server.crt" SSLCertificateKeyFile "crt/site.test/server.key"5 was returned. |
8.0.0 | Sự mô tảOpenSSLAsymmetricKey instance now; previously, a resource of type ## site.test DocumentRoot "C:/xampp/htdocs" ServerName site.test ServerAlias *.site.test DocumentRoot "C:/xampp/htdocs" ServerName site.test ServerAlias *.site.test SSLEngine on SSLCertificateFile "crt/site.test/server.crt" SSLCertificateKeyFile "crt/site.test/server.key"7 was accepted. |
7.1.0 | Về thành công, chức năng này trả về một thể hiện openSslCerTyerIgningRequest ngay bây giờ; Trước đây, một tài nguyên loại ## site.test DocumentRoot "C:/xampp/htdocs" ServerName site.test ServerAlias *.site.test DocumentRoot "C:/xampp/htdocs" ServerName site.test ServerAlias *.site.test SSLEngine on SSLCertificateFile "crt/site.test/server.crt" SSLCertificateKeyFile "crt/site.test/server.key"5 đã được trả lại. |
private_key
chấp nhận một phiên bản openSsmmetrickey ngay bây giờ; Trước đây, một tài nguyên loại ## site.test
DocumentRoot "C:/xampp/htdocs"
ServerName site.test
ServerAlias *.site.test
DocumentRoot "C:/xampp/htdocs"
ServerName site.test
ServerAlias *.site.test
SSLEngine on
SSLCertificateFile "crt/site.test/server.crt"
SSLCertificateKeyFile "crt/site.test/server.key"
7 đã được chấp nhận.
options
bây giờ cũng hỗ trợ ## site.test
DocumentRoot "C:/xampp/htdocs"
ServerName site.test
ServerAlias *.site.test
DocumentRoot "C:/xampp/htdocs"
ServerName site.test
ServerAlias *.site.test
SSLEngine on
SSLCertificateFile "crt/site.test/server.crt"
SSLCertificateKeyFile "crt/site.test/server.key"
9.
distinguished_names
0
Ví dụ
distinguished_names
1
Ví dụ #1 Tạo chứng chỉ tự ký
- Ví dụ #2 Tạo chứng chỉ ECC tự ký [kể từ Php 7.1.0]
Xem thêm ¶
OpenSSL_CSR_Sign [] - Ký CSR bằng chứng chỉ khác [hoặc chính nó] và tạo chứng chỉ
distinguished_names
2
Ẩn danh ¶ ¶
7 năm trước
distinguished_names
3
distinguished_names
4
distinguished_names
5Người mất tích ¶ ¶
OpenSSL_CSR_Sign [] - Ký CSR bằng chứng chỉ khác [hoặc chính nó] và tạo chứng chỉ
distinguished_names
6
distinguished_names
7
distinguished_names
8
distinguished_names
9
private_key
0
private_key
1
private_key
2
private_key
3
private_key
4
private_key
5
private_key
6
private_key
7
distinguished_names
5Ẩn danh ¶ ¶
7 năm trước
private_key
9
private_key
0
private_key
1
private_key
2
private_key
3
Người mất tích ¶
private_key
5
distinguished_names
512 năm trước ¶
OpenSSL_CSR_Sign [] - Ký CSR bằng chứng chỉ khác [hoặc chính nó] và tạo chứng chỉ
private_key
7
Ẩn danh ¶ ¶
7 năm trước
private_key
8
private_key
9
options
0
options
1
distinguished_names
5Người mất tích ¶ ¶
12 năm trước
options
3
options
4
options
5
options
6
options
7
distinguished_names
5James tại Kirk Dot Com ¶ ¶
12 năm trước
options
9
James tại Kirk Dot Com ¶ ¶
12 năm trước
openssl.conf
0
openssl.conf
1
distinguished_names
5James tại Kirk Dot Com ¶ ¶
Main Att Jokester Dott fr ¶
openssl.conf
3
openssl.conf
4
distinguished_names
5