Tomcat configuration HTTPS

Source: Internet
Author: User

1. generate the KeyStore file. keytool-v-genkey-alias tomcat-keyalg rsa-keystore d:/tomcat.keystore-validity 36500

Here Keytool in the JDK bin directory, you can also write an absolute address, where the password is written 123456, the following to use


This generates the Tomcat.keystore


2, Modify the Tomcat/conf/server.xml, and specify the security certificate location and password

<connector port= "443" protocol= "Org.apache.coyote.http11.Http11Protocol" sslenabled= "true"               maxthreads= "150 "Scheme=" https "secure=" true "               clientauth=" false "sslprotocol=" TLS "keystorefile=" D:/tomcat.keystore " keystorepass= "123456"/>


At this point, both HTTP and HTTPS can access the project, and to completely disable HTTP, you need to modify the following

8080 and 8009 (where the port is changed to 8003) corresponds to 443

<connector port= "8080" protocol= "http/1.1"                connectiontimeout= "20000"                redirectport= "443"/><!-- Define an AJP 1.3 Connector on port 8009--    <connector port= "8003" protocol= "ajp/1.3" redirectport= "443"/>



3. Configure the WEB.XM, and add the following after the Welcome-file-list

<welcome-file-list>        <welcome-file>index.html</welcome-file>        <welcome-file> index.htm</welcome-file>        <welcome-file>index.jsp</welcome-file>    </ welcome-file-list><login-config><!--Authorization setting for SSL--><auth-method>client-cert </auth-method><realm-name>client Cert user-only area</realm-name>    </login-config>    <security-constraint><!--Authorization setting for ssl--><web-resource-collection>< web-resource-name>ssl</web-resource-name><url-pattern>/*</url-pattern></ web-resource-collection>        <user-data-constraint>     <transport-guarantee>confidential</ transport-guarantee>        </user-data-constraint>    </security-constraint>

To disable HTTP unsafe methods, the configuration here can be written like this

 <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm </welcome-file> <welcome-file>index.jsp</welcome-file> </welcome-file-list><login-con fig><!--Authorization setting for SSL--><auth-method>client-cert</auth-method><realm-name >client Cert user-only area</realm-name> </login-config> <security-constraint><!--Authoriza tion setting for ssl--><web-resource-collection><web-resource-name>ssl</web-resource-name> <url-pattern>/*</url-pattern></web-resource-collection> <user-data-constraint> <tran Sport-guarantee>confidential</transport-guarantee> </user-data-constraint> </security-constrai Nt> <security-constraint><web-resource-collection><web-resource-name>fortune</ Web-resource-name><url-pattern>/*</url-pattern>


4. Load the project and import the certificate after startup

There is a problem accessing the Https://localhost:443/spfxzd security certificate, right-click









Certificate--Details--Copy to file--next--until export file to desktop file is Tomcat.cer

Here you can double-click the certificate under Install

Open your browser's Internet options below----> content----> Certificates


Select Trusted Root Certification Authorities----> Import certificates


Import the generated certificate in


Complete

Reference configuration: http://www.cnblogs.com/wanghaoyuhappy/p/5267702.html

Tomcat configuration HTTPS

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.