Configuration prerequisite Nginx installed the SSL function module.
[Root@www conf]# OpenSSL genrsa-out cert.key2 2048 generate Cert.key2 private key file
Generating RSA private key, 2048 bit long modulus
......................+++
..................................................................................+++
E is 65537 (0x10001)
[Root@www conf]# OpenSSL req-new-x509-key cert.key2-out cert.pem2 to generate Cert.key2 authentication files with cert.pem2
are about to is asked to enter information that would be incorporated
into your certificate request.
What you are about to enter the What is called a distinguished Name or a DN.
There are quite a few fields but you can leave some
For some fields there would be a default value,
If you enter '. ', the field would be left blank.
-----
Country Name (2 letter code) [XX]:CN always Enter
State or province name (full name) []:
Locality Name (eg, city) [Default City]:
Organization Name (eg, company) [Default company LTD]:
Organizational unit Name (eg, section) []: Slow down .... Here's something to enter.
Common name (eg, your name or your server ' s hostname) []:www.wang.com #输你的域名
Email Address []:
vim/usr/local/nginx/conf/nginx.conf Edit configuration file Add a server can copy my modifications in the fix.
server {
Listen 443; Port number to change.
server_name www.wang.com; Domain name to be changed.
SSL on;
SSL_CERTIFICATE/USR/LOCAL/NGINX/CONF/CERT.PEM2; The authentication file path is written well.
Ssl_certificate_key/usr/local/nginx/conf/cert.key2; The private key file path is well written.
Ssl_session_cache shared:ssl:1m;
Ssl_session_timeout 5m;
Ssl_ciphers high:!anull:! MD5;
Ssl_prefer_server_ciphers on;
Location/{
Root/var/www/html/web1; Your site directory, it is best to write absolute path.
Index index.html index.htm; Home page files.
}
}
The firewall adds a command that allows port 443.
We've got it. Reboot the Nginx. Sometimes it's not.
Netstat-anput |grep Nginx
Check to see if Nginx is listening to port 443.
Firewall, kernel firewall off.
Access.
Ok.