Reference documents:
1. NginxV1.8.0 Installation and Configuration
2. Add SSL Certificate in Nginx under CentOS to support HTTPS protocol access
3. How to configure the SSL certificate for Nginx
4, Nginx forced to use HTTPS access (HTTP jump to HTTPS)
5, Nginx SSL 107 (NET::ERR_SSL_PROTOCOL_ERROR) cannot establish a secure connection solution with the server
The configuration process is as follows:
My nginx is Yum installation specific installation process reference: [Go]centos 6.5 Configure yum install nginx+ server load Balancer
First, install the relevant support library: (Reference NginxV1.8.0 installation and configuration )
Yum-y Install gcc gcc-c++ autoconf
Yum-y Install OpenSSL Openssl-devel
Update to the latest support library
Second, edit the configuration file
# Vim/etc/nginx/conf.d/default or vim/etc/nginx/conf.d/example_ssl.conf
Mine is vim/etc/nginx/conf.d/example_ssl.conf .
Configuration examples
# HTTPS Server # server { Listen 443 ; server_name localhost; SSL on ; Ssl_certificate /etc/nginx/ssl/xx.com.crt; Ssl_certificate_key /etc/nginx/ssl/xx.com.key; Ssl_session_cache shared:ssl:1m; Ssl_session_timeout 5m; Ssl_ciphers High :!anull:! MD5; Ssl_prefer_server_ciphers on ; / { root /usr/share/nginx/html; Index index.html index.htm; }}
Three, restart Nginx, complete
sudo service nginx restart
The Pem pass phrase is typically queried during the restart process because the RSA private key file is protected with a passphrase. When the CA issued a certificate, set a password protection, in the case of knowing the secret word, you can use OpenSSL to remove the protection, restart Nginx will not prompt for the password.
Problems that may be encountered:
Four, Nginx forced to use HTTPS access (HTTP jump to HTTPS)
Configuration
server { listen ; server_name test.com; ........ Rewrite ^ (. *) $ https://$host $ permanent; # Add this line to force a jump
......}
CentOS6.5 Add SSL Certificate in Nginx to support HTTPS protocol access