The first step: first, to have a working Nginx server. Skip over.
Step two: Generate the certificate. Make sure OpenSSL and Openssl-devel are installed. Run the command yum install Oepnssl and yum install Openssl-devel.
Issue your own certificate to yourself (http://www.cnblogs.com/tintin1926/archive/2012/07/12/2587311.html). I made some adjustments based on my own computer.
#cd/etc/nginx
#openssl genrsa-des3-out server.key 1024
#openssl req-new-key server.key-out SERVER.CSR
#o Penssl rsa-in server.key-out server_nopwd.key
#openssl x509-req-days 3650-in server.csr-signkey Server_nopwd.key -out SERVER.CRT
The above procedure requires you to enter a password or some other parameter as prompted. For specific explanations, see (http://www.360doc.com/content/14/0513/15/1123425_377252552.shtml).
After the certificate is generated, you will find several more files in the current directory: Server.key, SERVER.CSR, and Server_nopwd.key.
Step three: Configure Nginx. My Nginx version is 1.8.0. There is a default.conf and example_ssl.conf file under the/etc/nginx/conf.d/directory. Copy example_ssl.conf and rename it to open_ssl.conf. Open open_ssl.conf. Uncomment and replace the corresponding section in this file with the location code specified in default.conf. Configure the key file that you just generated
SSL_CERTIFICATE/ETC/NGINX/SERVER.CRT;
Ssl_certificate_key/etc/nginx/server_nopwd.key;
Restart Nginx (nginx-s reload).
Fourth step: Browser Test. https://10.0.1.62/hello.php. Prompt certificate not trusted, ignore, go to unsafe link.