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

How to install docker under centos and remotely publish docker in springboot

Table of contents 1. Installation of JDK1.8 under...

Mysql 5.7.17 winx64 installation tutorial on win7

Software version and platform: MySQL-5.7.17-winx6...

Detailed explanation of the spacing problem between img tags

IMG tag basic analysis In HTML5, the img tag has ...

Detailed explanation of CSS3 flex box automatic filling writing

This article mainly introduces the detailed expla...

JS implements the sample code of decimal conversion to hexadecimal

Preface When we write code, we occasionally encou...

Detailed explanation of the process of installing msf on Linux system

Or write down the installation process yourself! ...

Tutorial on installing and configuring remote login to MySQL under Ubuntu

This article shares the MySQL installation and co...

Batch replace part of the data of a field in Mysql (recommended)

Batch replace part of the data of a field in MYSQ...

Detailed tutorial on how to create a user in mysql and grant user permissions

Table of contents User Management Create a new us...

Detailed description of the life cycle of React components

Table of contents 1. What is the life cycle 2. Lo...

An example of how Tomcat manages Session

Learned ConcurrentHashMap but don’t know how to a...