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

Analysis of Linux Zabbix custom monitoring and alarm implementation process

Target Display one of the data in the iostat comm...

jQuery plugin to implement stacked menu

A jQuery plugin every day - stacked menu, for you...

How to check whether a port is occupied in LINUX

I have never been able to figure out whether the ...

Sample code for implementing interface signature with Vue+Springboot

1. Implementation ideas The purpose of interface ...

Detailed explanation of dynamically generated tables using javascript

*Create a page: two input boxes and a button *Cod...

MySQL integrity constraints definition and example tutorial

Table of contents Integrity constraints Definitio...

4 functions implemented by the transform attribute in CSS3

In CSS3, the transform function can be used to im...

Detailed explanation of the role of brackets in AngularJS

1. The role of brackets 1.1 Square brackets [ ] W...

What is a MySQL tablespace?

The topic I want to share with you today is: &quo...

Use iframe to display weather effects on web pages

CSS: Copy code The code is as follows: *{margin:0;...

js, css, html determine the various versions of the browser

Use regular expressions to determine the IE browse...

Implementing WeChat tap animation effect based on CSS3 animation attribute

Seeing the recent popular WeChat tap function, I ...