Hướng dẫn certificate php - chứng chỉ php

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

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.

Mặc định XAMPP đợc cài đặt trong thư mục C:\xampp\apache.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

Hướng dẫn certificate php - chứng chỉ php

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

  1. 7. Thêm tên miền này vào file conf của XAMPP.
  2. 8. Khởi động lại trình duyệt và thử lại!
  3. 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\crtGenerates a CSR

Và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.: 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.

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.conf

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.

Tiếp tục chọn “Place all certificate in the following store” và click browse sau đó chọn Trusted Root Certification Authorities.openssl_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.

Chọn Next và Finish.

Và bây giờ chứng chỉ này đã được cài đặt là tin cậy (trusted) trong Windows. Tiếp theo là làm thế nào để sử dụng chứng chỉ này trong XAMPP.

Mở notepad với quyền administrator.
Sửa C:\Windows\System32\drivers\etc\hostsThêm một dòng mới:Điều này sẽ giúp XAMPP khi truy cập http://site.test sẽ trỏ tên miền này về IP localhostGiờ 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.conf
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.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!openssl_get_md_methods()
Ngôi Sao Số hy vọng hướng dẫn này hữu ích!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. Ngôi Sao Số hy vọng hướng dẫn này hữu ích!(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)
openssl_csr_new — Generates a CSRSau đó, 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. openssl_csr_new — Generates a CSRDescription
private_key_bitsint Default_bitsChỉ định số lượng bit nên được sử dụng để tạo khóa riêng
private_key_typeint không aiChỉ định loại khóa riêng để tạo. Đây có thể là một trong số
127.0.0.1 site.test
5,
127.0.0.1 site.test
6,
127.0.0.1 site.test
7 hoặc
127.0.0.1 site.test
8. Giá trị mặc định là
127.0.0.1 site.test
7.
127.0.0.1 site.test
5
,
127.0.0.1 site.test
6
,
127.0.0.1 site.test
7
or
127.0.0.1 site.test
8
. The default value is
127.0.0.1 site.test
7
.
Encrypt_keybool Encrypt_keybool
Có nên mã hóa khóa được xuất (với cụm mật khẩu)?int không aiChỉ định loại khóa riêng để tạo. Đây có thể là một trong số
127.0.0.1 site.test
5,
127.0.0.1 site.test
6,
127.0.0.1 site.test
7 hoặc
127.0.0.1 site.test
8. Giá trị mặc định là
127.0.0.1 site.test
7.
Encrypt_keybool không aiChỉ định loại khóa riêng để tạo. Đây có thể là một trong số
127.0.0.1 site.test
5,
127.0.0.1 site.test
6,
127.0.0.1 site.test
7 hoặc
127.0.0.1 site.test
8. Giá trị mặc định là
127.0.0.1 site.test
7.openssl_get_curve_names().
Encrypt_keybool Có nên mã hóa khóa được xuất (với cụm mật khẩu)?Encrypt_key_codes
Một trong những hằng số mật mã.

đường cong_name

sợi dây

Một trong các openSSL_GET_CURVE_NAME ().

## 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.

Cấu hình

N/a Đường dẫn đến tệp OpenSSL.conf thay thế của riêng bạn.
8.0.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"
 
0OpenSSLCertificateSigningRequest 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
## 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
## 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.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 Trả về giá trị

Trả về CSR hoặc ## 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 khi thất bại.

Thay đổi

distinguished_names0

Phiên bản

distinguished_names1

Sự mô tả

  • 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_names2

Ví dụ

Ví dụ #1 Tạo chứng chỉ tự ký

distinguished_names3

distinguished_names4

distinguished_names5

Ví dụ #2 Tạo chứng chỉ ECC tự ký (kể từ Php 7.1.0)

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_names6

distinguished_names7

distinguished_names8

distinguished_names9

private_key0

private_key1

private_key2

private_key3

private_key4

private_key5

private_key6

private_key7

distinguished_names5

Ví dụ

Ví dụ #1 Tạo chứng chỉ tự ký

private_key9

private_key0

private_key1

private_key2

private_key3

Ví dụ #2 Tạo chứng chỉ ECC tự ký (kể từ Php 7.1.0)

private_key5

distinguished_names5

Xem thêm

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.

private_key7

Ví dụ

Ví dụ #1 Tạo chứng chỉ tự ký

private_key8

private_key9

options0

options1

distinguished_names5

Ví dụ #2 Tạo chứng chỉ ECC tự ký (kể từ Php 7.1.0)

Xem thêm

options3

options4

options5

options6

options7

distinguished_names5

OpenSSL_CSR_Sign () - Ký CSR bằng chứng chỉ khác (hoặc chính nó) và tạo chứng chỉ

Xem thêm

options9

OpenSSL_CSR_Sign () - Ký CSR bằng chứng chỉ khác (hoặc chính nó) và tạo chứng chỉ

Xem thêm

openssl.conf0

openssl.conf1

distinguished_names5

OpenSSL_CSR_Sign () - Ký CSR bằng chứng chỉ khác (hoặc chính nó) và tạo chứng chỉ

Ẩn danh ¶

openssl.conf3

openssl.conf4

distinguished_names5