Nginx+tomcat Configuration supports HTTPS

Source: Internet
Author: User
Tags openssl openssl rsa openssl x509 tomcat

nginx Configuration supports HTTPS access

To generate a certificate:

1. Create the server private key, the command will let you enter a password:

OpenSSL genrsa-des3-out Server.key 1024


Password to take a random

2. Create a signing Request certificate (CSR):

OpenSSL Req-new-key server.key-out SERVER.CSR


3. Remove the required password when loading SSL-supported Nginx and using the private key above:

CP Server.key server.key.org

OpenSSL rsa-in server.key.org-out Server.key


4. Mark certificates use the above private key and CSR:

OpenSSL x509-req-days 365-in server.csr-signkey server.key-out server.crt


to modify the Nginx configuration:

1. Copy server.crt and Server.key to the specified directory


2. Modify the configuration file to load SERVER.CRT and Server.key


3. Restart Nginx

At this point, the Nginx HTTPS has been configured to complete.

Reference:

Http://www.cnblogs.com/yanghuahui/archive/2012/06/25/2561568.html

Http://www.abcde.cn/info/show-26-1511-1.html

Tomcat Configuration supports HTTPS access

1. Create a KeyStore file to store the server's private key and self-signed certificate.

HTTPS communication simply said, the server's certificate contains the server's public key, and then the browser and the server communication, the browser can use the server's public key to encrypt the message, the server can use its own private key to decrypt the message, so that the completion of the secure communication, In fact, the communication process of HTTPS is far more complicated than this.

Keytool-genkey-alias Tomcat-keyalg RSA

A. keystore file is generated under the C:\Users\user directory, which holds the private key and certificate information to view keystore information: Keytool-list-v-keystore.keystore


The. KeyStore file contains both the certificate and the private key.

2. Let tomcat load the self-signed certificate. Store the. keystore file under Tomcat's Conf directory and modify the Server.xml:

<connectorport= "8443" sslenabled= "true"

maxthreads= "Scheme=" "https" secure= "true"

Clientauth= "false" sslprotocol= "TLS"

Protocol= "Org.apache.coyote.http11.Http11Protocol"

keystorepass= "123456" keystorefile= "Conf/.keystore"/>

3. Restart Tomcat.

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.