Linux Nginx configuration SSL
Check if the ssl module is installed
Execute: ./nginx -V
command
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 objs
a folder
We enter this directory, there is an nginx service
/usr/local/nginx/sbin/
Execute the nginx under the coverage of nginx in this directory
: cp ./nginx /usr/local/nginx/sbin/
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 -V
command
SSL module already installed
Configure SSL certificate
Create a new directory under the nginx
installation directory , and put the applied SSL certificate intoconf
cert
Modify the Nginx configuration file.
Let go of the 443 SSL related comments at the bottom.
Modify these two attributes
and change them to our own SSL certificate file.
restart nginx
Access Test: https://ip
Just OK