background
I installed centos7 using vmware , and then installed the pagoda system for local development.
First, you need to go to the hosts file to configure the URL to point to the ip:
Assuming that the virtual machine ip is 192.168.0.108 and the domain name you want to map is dzzs.com.cn, then configure it like this:
192.168.0.108 dzzs.com.cn
Next, you need to install the local ssl certificate
Certificate Application
Usually OpenSSL is used to generate the self-signed certificate, but the commands of OpenSSL are more complicated and the parameters are more complicated, so it is not convenient to use. Here use mkcert to apply for a certificate.
Project address: GitHub - FiloSottile/mkcert
Download it according to the tutorial on README.md and execute it in sequence:
sudo yum install nss-tools
curl -JLO "https://dl.filippo.io/mkcert/latest?for=linux/amd64"
chmod +x mkcert-v*-linux-amd64
sudo mv mkcert-v*-linux-amd64 /usr/local/bin/mkcert
Execute the following command to check the version:
mkcert -version
Execute the following command to install mkcert's certificate authority on the server:
mkcert -install
Create a certificate for the domain name:
mkcert dzzs.com.cn
The location of the certificate can be viewed with the following command:
[root@localhost ~]# mkcert -CAROOT
/root/.local/share/mkcer
There are two files in this directory: rootCA-key.pem and rootCA.pem.
Copy rootCA.pem to the PC and change its suffix to .crt. Double-click rootCA.crt and install the certificate according to the prompts. The steps are as follows:
Certificate configuration
Next, we configure the certificate we just applied for on the server. Here we take the pagoda as an example:
Put the contents of these two files into the corresponding edit boxes, and save them at last.
Note: If you look at the effect, there may be problems due to caching. At this time, you can change the browser or open the privacy mode to check whether HTTPS is successfully enabled.
Reference: Develop a new local
SSL certificate (https use)