Use HTTPS instead of HTTP

Source: Internet
Author: User

The following solutions use self-signed certificates. You can see more details on self-signed steps at http://xiaohuafyle.iteye.com/blog/1538719. certificate:self-signed (need Java keytool to generate certificates)
System:linux  = = = 1 Generate a self-signed CA = = = = =Open a terminal and generate a self-signed CA by following:1. catalina_home/conf/sslcertificate> keytool-genkey-v-alias tomcat-keyalg rsa-validity 365-keystore tomcat.keyst Ore
Where 365 means the CA would be valid for 365 days, and the Tomcat.keystore would be stored in the current directory. After pressing ' Enter ', you is required to input name, ..., password, ... Note The name is domain name (e.g. www.siemens.com, more recommended) or IP address (e.g. 139.24.236.50). You had to rememebr the KeyStore password and tomcat password you set on this step, which would be needed later. 2. catalina_home/conf/sslcertificate> keytool-export-alias tomcat-keystore tomcat.keystore-file tomcat.cer
Enter the KeyStore password when required.   = = 2 Tomcat Configuration = = = =1. Make sure, the KeyStore file (i.e. Tomcat.keystore) is under tomcat/conf/sslcertificate/ 2. Open catalina_home/conf/server.xml and modify the corresponding connectors to:
<connector port= "8888" protocol= "http/1.1"
connectiontimeout= "20000"
Redirectport= "8443"/><connector port= "8443" protocol= "Org.apache.coyote.http11.Http11Protocol" sslenabled= "true"
maxthreads= "Scheme=" "https" secure= "true"
Clientauth= "false" sslprotocol= "TLS"
Keystorefile= "Conf/sslcertificate/tomcat13.keystore" keystorepass= "Cas24mega "/> Note:
(1) Redirectport is set because HTTP uses port 8888 and HTTPS uses port 8443.
(2) Remember to set Keystorefile and Keystorepass
(3) When you set the path for Keystorefile, being carefull it is "conf/..." Not "/conf/...". The difference is "/". This is important. 3. Open catalina_home/conf/web.xml, and add the following lines after <welcome-file-list>...</ Welcome-file-list><login-config>
<!--Authorization setting for Ssl:set authentication Method--
<auth-method>CLIENT-CERT</auth-method>
<realm-name>client Cert users-only area</realm-name>
</login-config>
<security-constraint>
<!--Authorization setting for Ssl:force HTTPS transmission--
<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>You can see more details at Tomcat to set http auto jump to HTTPS access . Also, I recommend you to search more information on "Client-cert" to see the differences among different authentication Methods. 4. Finally, restart Tomcat service and test the page.
e.g. http://xxx.xxx.xxx.xxx:portNumber/webApp

Use HTTPS instead of HTTP

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.