The SSL module is not installed by default, and if you want to use the module, you will need to specify the –with-http_ssl_module parameter at compile time, and the installation module relies on the OpenSSL library and some reference files, usually not in the same package. Usually this file name is similar to Libssl-dev
1. Generate certificate1.1Create a server private key
mkdir–p/application/nginx/sslkey/# Create a certificate directory
cd/application/nginx/sslkey/
opensslgenrsa-des3-out Server.key # Create a certificate enter a password
Generatingrsa private key, 1024x768 bit long modulus
.++++++
............................................................++++++
EIS 65537 (0x10001)
Enterpass Phrase for Server.key:
Verifying-enter Pass phrase for Server.key:
1.2Create a certificate for a signed request(CSR)
[Email protected]]# OpenSSL req-new-key server.key-out SERVER.CSR
Enter Pass phrase forserver.key: (Enter the password set in the previous step)
Beasked to enter information that'll be incorporated
Into your certificaterequest.
What's about Toenter is called a distinguished Name or a DN.
There is quite a fewfields but can leave some blank
For some fields Therewill is a default value,
If you enter '. ', Thefield'll be a left blank.
-----
Country Name (2 lettercode) [XX]:CN
State or province name (full name) []:BJ
Locality Name (eg,city) [Default CITY]:BJ
Organization Name (Eg,company) [Default company LTD]:BJ
Organizational unitname (eg, section) []:BJ
Common Name (eg, yourname or your server ' s hostname) []:BJ
Email Address []:BJ
Please enter thefollowing ' extra ' attributes
To is sent with yourcertificate request
A Challenge password[]:123456
An optional CompanyName []:123456
1.3in the LoadSslsupported byNginxand remove the required password when using the above private key:
[Email protected]]# cp Server.key server.key.org
[Email protected]]# OpenSSL rsa-in server.key.org-out server.key
Enterpass Phrase for server.key.org:
Writingrsa Key
1.4The last token certificate uses the above private key andDS5
[Email protected]]# OpenSSL x509-req-days 365-in server.csr-signkey server.key-outserver.crt
Signature OK
Subject=/c=cn/st=bj/l=bj/o=bj/ou=bj/cn=bj/emailaddress=bj
Getting Private Key
2. Configurationnginx2.1ModifyNginxconfiguration file
Vim blog.conf # Add the following lines at the beginning
server_nameblog.etiantian.org;
Listen 443;
SSL on;
SSL_CERTIFICATE/APPLICATION/NGINX/SSLKEY/SERVER.CRT;
Ssl_certificate_key/application/nginx/sslkey/server.key;
This article is from the "10997527" blog, please be sure to keep this source http://11007527.blog.51cto.com/10997527/1982886
Nginx for HTTPS access