Linux configuration Nginx SSL supports Https configuration tutorial

继承上篇 Install Nginx on Linux

Check if the ssl module is installed

Execute: ./nginx -Vcommand
insert image description here
If there is output --–with-http_ssl_module, it means that the SSL module has been installed

Install SSL

Enter the installation directory /usr/local/nginx-1.22.1
and execute the installation command:./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module

Execute the compilation command: make
Note: Do not execute the make install command after the make is successful, otherwise nginx will be reinstalled.

After successful execution, the current directory will generate objsa folder

insert image description here
We enter this directory, there is an nginx service
insert image description here

/usr/local/nginx/sbin/Execute the nginx under the coverage of nginx in this directory
: cp ./nginx /usr/local/nginx/sbin/
insert image description here
this problem needs to stop the nginx service, and re-execute this command
to stop nginx:/usr/local/nginx/sbin/nginx -s stop

Recheck if the SSL module is installed: ./nginx -Vcommand
insert image description here
SSL module already installed

Configure SSL certificate

Create a new directory under the nginxinstallation directory , and put the applied SSL certificate intoconfcert
insert image description here

Modify the Nginx configuration file.
Let go of the 443 SSL related comments at the bottom.
insert image description here
Modify these two attributes
insert image description here
and change them to our own SSL certificate file.

restart nginx

Access Test: https://ipJust OK

insert image description here
insert image description here

Guess you like

Origin blog.csdn.net/A_yonga/article/details/132339632