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
In the previous chapters, we have learned how to ...
Table of contents 1. Slow query configuration 1-1...
This article shares the specific code for React t...
1. Basic implementation of limit In general, the ...
Related reading: Solve the problem that the servi...
When modifying Magento frequently, you may encount...
Table of contents 1. What is a subquery? 2. Self-...
Table of contents Preface advantage: shortcoming:...
This article introduces how to install MySQL 8.0 ...
Table of contents Overview 1. Stack and Heap 2. V...
translate(-50%,-50%) attributes: Move it up and l...
As we all know, there are two types of images in c...
Note: It is recommended that the virtual machine ...
Table of contents 1. Table self-sorting 2. Paging...
Prerequisites Need to install git Installation St...