Environment Preparation:

Win64 OpenSSL v1.1.0 h

Nginx/Windows, version 1.8.1 –



OpenSSL environment variable Settings:

My computer – “Properties -” advanced System Settings – “Environment variables -” user variables (you can configure them in system variables if you want them to be common to all users)

Variable name: OPENSSL_HOME Value: C:\ openSSL-win64 \bin; (Variable value is openSSL installation location, mine)

Add the following to the end of the path variable: %OPENSSL_HOME%;

Nginx 中 文 版 : Nginx 中 文 版 : Nginx 中 文 版

Nginx-1.8.1 >start nginx :\nginx-1.8.1>nginx.exe

Nginx-1.8.1 >nginx.exe -s quit C:\nginx-1.8.1>nginx.exe -s quit C:\nginx-1.8.1>nginx.exe -s quit Quit is a complete and orderly stop to nginx and save the information.

Exe -s reload Reload Nginx: C:\nginx-1.8.1>nginx.exe -s reload Reload Nginx: C:\nginx-1.8.1>nginx.exe -s reload Reload Nginx: C:\nginx-1.8.1>nginx.exe -s reload Reload Nginx: C:\nginx-1.8.1

C:\nginx-1.8.1>nginx.exe -s reopen

C:\nginx-1.8.1> nginx-v

Select * from nginx.exe where name = nginx.exe;

Taskkill /fi imagename eq nginx.EXE /f

Create a private key, create a CSR certificate

  1. Create an SSL folder in the nginx installation path to store the certificate
  2. To create a private key, run the openssl genrsa -des3 -out nj.key 1024 command

  3. To create a CSR certificate, run the openssl req -new-key nj. key-out nj. CSR command

    A few points to note here: Input password is set in the previous step, other can always press enter, press enter

  4. Perform the following operations to copy the file, remove the password, and generate the CRT certificate

    On the CLI, run the copy nj.key nj.key.copy command

    Run the openssl rsa -in nj.key.copy -out nj.key command on the CLI

    Run the openssl x509 -req -days 365 -in nj. CSR -signkey nJ. key command on the CLI

To this certificate, the generation is complete. Here is the cofig file for configuring Nginx.

Modify the C:/nginx-1.8.1/conf/nginx.conf file

Note the following: 1. Set the certificate path to a relative path rather than an absolute path

2. Comment out several lines of SSL_session_cache according to the error log.

3. Location Configure the pointing path based on project requirements.