Nginx Configure Web site SSL authentication

Source: Internet
Author: User
Tags website server csr certificate

Free public certificate can be obtained from the startcom website, url: https://startssl.com/, register an account, and then press Certificates Wizard steps to fill in the information



The next step is to fill in the CSR certificate information, you can download the Red Arrows at the StartComTool.exe generation, the production of CSR certificates will also generate a. Key's private key file, which is later used when configuring the Nginx certificate.

After the step is complete, view the list of Certificates in tool box-certificate list


Click Retrieve to download the certificate package, and then there are 4 files, which are the certificates used by different servers


Because my website server is using Nginx, so I only need nginxserver.zip, decompression is a CRT certificate file

The following is how to configure the certificate in the Nginx configuration file, where the. key file is the private key file that was generated before the CSR certificate was generated with StartComTool.exe

server {Listen 80;
        CharSet Utf-8;

        server_name domain_name; Location ~/\d+/.*\. (Jpg| Jpg|png| Png|gif| Gif|jpeg|
                JPEG) {root/mnt/img01/;
        Expires 7d;
                } location ^~/images/{root/var/www/wap;
        Expires 7d;
                } location ^~/js/{root/var/www/wap;
        Expires 7d;
                } location ^~/css/{root/var/www/wap;
        Expires 7d; } location ~ \. (html|jsp)
        {Proxy_pass http://127.0.0.1:9202;
        Location ^~/user/login.html{return https://$server _name$request_uri;
        Location ^~/usercenter/index.html{return https://$server _name$request_uri;
        Location ^~/venue/order-confirm.html{return https://$server _name$request_uri; } Location ^~/activity/order-confirm.html{return https://$server _name$request_uri;
        } server {Listen 443;
        server_name domain_name;
        SSL on;
        Ssl_certificate XXX.CRT;
        Ssl_certificate_key Xxx.key;
        Ssl_session_cache shared:ssl:20m;
        Ssl_session_timeout 20m;
                Location/{Proxy_set_header x-forwarded-host $host;
                Proxy_set_header X-forwarded-server $host;
                Proxy_set_header x-forwarded-for $proxy _add_x_forwarded_for;
                #proxy_pass http://127.0.0.1:9202;
                Proxy_pass Http://wap_tomcat;
                Proxy_set_header X-forwarded-proto HTTPS;
        #proxy_redirect off; }
}
This section configuration configured domain_name partial URI address need SSL authentication, return 301 way Jump, also can use redirect way


The SSL protocol layer for Tomcat is not configured here, and if required, the P12 certificate can be produced in Toolbox-create pkcs#12 (PFX) file on the StartCom Web site and then generated Keytool via JDK KeyStore



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.