1. Installation
Nginx to install the Http_ssl_module module, the OpenSSL library and related development packages are required, so these support must be installed before installation
Under the CentOS system, install directly with Yum: # Yum installs OpenSSL Openssl-devel
Compiling Nginx
# TAR-ZXVF Pcre-8.12.tar.gz
# CD pcre-8.12
#./configure–prefix=/usr/local
# make
# make Install
# TAR-ZXVF Nginx-1.0.0.tar.gz
# CD nginx-1.0.0
#./configure–prefix=/usr/local/nginx–user=www–group=www–with-http_ssl_module–with-pcre
# make
# make Install
2. Making key (single authentication)
# Mkdir/usr/local/nginx/ssl
# Cd/usr/local/nginx/ssl
# OpenSSL Genrsa-des3-out server.key 1024 (set up the server private key, you need to enter the passphrase in this process, you need to remember this password)
# OpenSSL Req-new-key server.key-out SERVER.CSR
After entering the command, you need to fill in the following:
Country Name (Country: China fill cn)
State or province Name (region or province: Chongqing)
Locality name (region local name: Chongqing)
Organization Name (institution name: Fill in Company name)
Organizational Unit name (organizational unit: Department name)
Common Name (website domain name)
Email address (e-mail)
A challenge password (enter a password)
An optional corporation name (an optional company name)
After entering this, the SERVER.CSR file is generated in the current directory
# CP Server.key server.key.org
# OpenSSL rsa-in server.key.org-out Server.key (for using the above private key to start an Nginx with SSL function)
# OpenSSL x509-req-days 365-in server.csr-signkey server.key-out server.crt (the certificate is signed with the above key and CSR
name)
Edit the Nginx configuration file that requires the domain name of HTTPS (the name of the common name website that was filled in)
server {
server_name www.xxx.com;
ssl on;
 SSL_CERTIFICATE/USR/LOCAL/NGINX/SSL/SERVER.CRT;
ssl_certificate_key/usr/local/nginx/ssl/server.key;
}
Save, restart Nginx, so that a simple HTTPS service website (single authentication) is built.
Nginx Server configuration support for HTTPS