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

Introduction to JavaScript Number and Math Objects

Table of contents 1. Number in JavaScript 2. Math...

Record a slow query event caused by a misjudgment of the online MySQL optimizer

Preface: I received crazy slow query and request ...

express project file directory description and detailed function description

app.js: startup file, or entry file package.json:...

Summary of situations where MySQL indexes will not be used

Types of Indexes in MySQL Generally, they can be ...

An article to help you learn CSS3 picture borders

Using the CSS3 border-image property, you can set...

Grid systems in web design

Formation of the grid system In 1692, the newly c...

The corresponding attributes and usage of XHTML tags in CSS

When I first started designing web pages using XH...

The concept and characteristics of MySQL custom variables

A MySQL custom value is a temporary container for...

Detailed explanation of CSS sticky positioning position: sticky problem pit

Preface: position:sticky is a new attribute of CS...

Detailed explanation of overflow-scrolling to solve scrolling lag problem

Preface If you use the overflow: scroll attribute...

Vue uses element-ui to implement menu navigation

This article shares the specific code of Vue usin...

Example verification MySQL | update field with the same value will record binlog

1. Introduction A few days ago, a development col...