Nginx Configure HTTPS service on Linux __linux

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.