Implementation of Nginx configuration https

Implementation of Nginx configuration https

1: Prepare https certificate

https certificate: I received a one-year free https certificate from Huawei.

Download Certificate

We are configuring nginx certificate, so just take the certificate in the nginx file

2: Prepare nginx ssl module

My path is: usr/local/nginx

Enter the nginx installation directory: usr/local/nginx

Command: ./sbin/nginx -v

Check whether there is an SSL module. The following figure shows that it is not installed.

Install the ssl module:

Generally, there is no SSL module. Next, enter your unzipped nginx directory. Note that this is not the nginx installation directory, but the unzipped directory. After entering the directory, enter

./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module

Then execute:

make

#Remember not to execute make install, otherwise nginx will be reinstalled

After the above operations are completed, the objs folder will appear in your directory, and the nginx file will exist in the folder, as shown in the figure:

Replace the nginx file in this directory with the one in the installation directory sbin:

#Enter the nginx installation directory to stop the nginx service

./sbin/nginx -s stop

If keepalive nginx high availability is installed, you need to stop keepalive,

If no system service is added, then pkill -9 keepalive

systemctl stop keepalived.service

#Replace the previous

nginx cp /root/nginx/objs/nginx /usr/local/nginx/sbin

After replacement, start keepalive and start nginx

Check whether the installation is successful

./sbin/nginx -V

If the following appears, SSL is installed successfully.

3: Configure SSL certificate

Create a cert directory in the Nginx installation directory and copy server.key and server.crt to the cert directory of nginx.

Configure the nginx.conf file in the nginx installation directory

Restart nginx ./sbin/nginx -s reload

4: Browser https protocol access, if the access is successful, https configuration is successful.

Huawei's official website also has configuration documents

This is the end of this article about the implementation of Nginx configuration https. For more relevant Nginx configuration https content, please search 123WORDPRESS.COM's previous articles or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future!

<<:  How to display TIF format images in browser

>>:  A complete guide to some uncommon but useful CSS attribute operations

Recommend

Vue implements a simple marquee effect

This article shares the specific code of Vue to a...

mysql obtains statistical data within a specified time period

mysql obtains statistical data within a specified...

How to count down the date using bash

Need to know how many days there are before an im...

A brief discussion on docker compose writing rules

This article does not introduce anything related ...

Vue global filter concepts, precautions and basic usage methods

Table of contents 1. The concept of filter 1. Cus...

CSS3 implements the sample code of NES game console

Achieve resultsImplementation Code html <input...

Coexistence of python2 and python3 under centos7 system

The first step is to check the version number and...

Solve the problem that vue project cannot carry cookies when started locally

Solve the problem that the vue project can be pac...

Analysis of the process of simply deploying nginx in Docker container

1. Deploy nginx service in container The centos:7...

Vue realizes adding watermark to uploaded pictures (upgraded version)

The vue project implements an upgraded version of...

Specific use of useRef in React

I believe that people who have experience with Re...

A brief analysis of the matching priority of Nginx configuration location

Preface The location in the server block in the N...

WeChat applet selects the image control

This article example shares the specific code for...