environment: 1 CentOS Linux release 7.5.1804 (Core) Start deployment: 1. Install nginx @1.1 Dependency Installation yum -y install wget gcc gcc-c++ pcre-devel openssl-devel @1.2 nginx software package download wget http://nginx.org/download/nginx-1.19.0.tar.gz @1.3 Unzip, compile, and install [root@localhost ~]# tar xf nginx-1.19.0.tar.gz [root@localhost ~]# cd nginx-1.19.0 [root@localhost nginx-1.19.0]# ./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module && make && make install @1.4 Switch to the nginx directory and make a soft link [root@localhost nginx-1.19.0]# cd /usr/local/nginx/ [root@localhost nginx]# ln -s /usr/local/nginx/sbin/nginx /usr/local/sbin/nginx 2. Configure private key and certificate @2.1 Create a private key [root@localhost nginx]# mkdir sslkey [root@localhost nginx]# cd sslkey/ [root@localhost sslkey]# openssl genrsa -des3 -out server.key 1024 @2.2 Generate certificate file [root@localhost sslkey]# openssl req -new -key server.key -out server.csr [root@localhost sslkey]# openssl req -x509 -days 3650 -key server.key -in server.csr > server.crt The -days parameter specifies the validity period of the certificate in days Use openssl x509 -noout -text -in server.crt to view the contents of the certificate. The certificate actually contains the Public Key [root@localhost sslkey]# openssl rsa -in server.key -out server.key.unsecure View the generated certificate and private key files 3. Configure nginx for https @3.1 Modify the configuration of nginx.conf, replace the listening port 80 with 443, and configure SSL authentication [root@localhost conf]# pwd /usr/local/nginx/conf [root@localhost conf]# vim nginx.conf server { listen 443; server_name localhost; ssl_certificate /usr/local/nginx/sslkey/server.crt; ssl_certificate_key /usr/local/nginx/sslkey/server.key.unsecure; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4; ssl_prefer_server_ciphers on; @3.2 Start nginx and check the port [root@localhost conf]# nginx [root@localhost conf]# ss -nltp|grep 443 LISTEN 0 128 *:443 *:* users:(("nginx",pid=25949,fd=6),("nginx",pid=25948,fd=6)) 4 Just access it through your browser! This is the end of this article about the detailed tutorial on configuring nginx for https encrypted access. For more relevant content about configuring nginx for https encrypted access, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
>>: JavaScript to achieve the effect of tab bar switching
Table of contents 1.union: You can add query resu...
Samba Services: This content is for reference of ...
Pull the image # docker pull codercom/code-server...
Preface: Vue3 has been released for a long time. ...
Table of contents 1. What is a window function? 1...
What you learn from books is always shallow, and ...
Optimistic Locking Optimistic locking is mostly i...
This article example shares the specific code of ...
Author: Ding Yi Source: https://chengxuzhixin.com...
Preface This article mainly introduces the releva...
Navigation, small amount of data table, centered &...
Table of contents Layout part: <div id="a...
Preface In daily development, we often encounter ...
0. System requirements CPU I5-10400F or above Mem...
When the carriage return character ( Ctrl+M ) mak...