Technology Sharing

Test environment: Generate a certificate using OpenSSL and configure HTTPS

2024-07-08

한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina

need

When calling some interfaces or using some components, they must be used in an https environment (such as h5 calling a mobile phone camera to scan a code); but since it is only used for testing and you don't want to spend money to buy a formal certificate, you can use this method to generate a certificate to simulate an https environment.

1. Install OpenSSL

1.1. Download the installation package

window:
Link: https://pan.baidu.com/s/1HlySuOy4FkzKK_vTOz9ZBg
Extraction code: 07ay

Linux:
Link: https://pan.baidu.com/s/1JDhUCERcqsZw1BoluapJJw
Extraction code: swwb

1.2. Installation (taking Windows 64-bit as an example)

choose Win64OpenSSL-3_0_0.exe Installation package, just install it normally, you can store it in the specified folder
insert image description here

1.3. Configure environment variables (optional)

After the installation is complete, you can set environment variables or not. The advantage of setting environment variables is that you can execute openssl commands through the cmd command line window at any location, while if you do not set environment variables, you need to enter the OpenSSL installation directory to perform command line operations.

Configuration Method: Right click "This PC" -