CAS configuration-tomcat https Configuration

Source: Internet
Author: User

To enable tomcat to use ssl, you must first configure its https. The configuration method is as follows:

1. Create a key

Enter cmd and enter

 
 
  1. keytool -genkey -alias tomcat -keystore mykeystore -keyalg RSA -validity 2000 

Follow the promptsEnter Password: Changeit,

What is your first name and last name? (Enter the domain name here. Enter localhost in the local test)

Just enter the remaining questions.

This will generate a mykeystore file under the C: \ Documents ents and Settings \ Administrator directory.

 
 
  1. keytool -export -alias tomcat -keystore mykeystore -file server.crt 

The password is also entered changeit. If the operation is successful, a file of server. crt will be generated under the directory, and then execute

 
 
  1. keytool -import -alias tomcat -file server.crt -keystore %JAVA_HOME%/jre/lib/security/cacerts 

After the password is entered, the key is created after you confirm that the password is correct.

2. Configure tomcat

Open conf/server. xml in the tomcat installation directory and add the following code:

 
 
  1. <Connector port="8443" protocol="org.apache.coyote.http11.Http11Protocol" SSLEnabled="true" 
  2.        maxThreads="150" scheme="https" secure="true" 
  3.        clientAuth="false" sslProtocol="TLS" 
  4.         keystoreFile="d:/mykeystore " 
  5.        keystorePass="changeit"/> 

The keystoreFile in the code can be written as an absolute path. Note that the protocol in the Code has different tomcat configurations in different versions. For details, refer:

Tomcat 4.1.34 Configuration

 
 
  1. <Connector className="org.apache.coyote.tomcat4.CoyoteConnector"    
  2.            port="8443" enableLookups="true" scheme="https" secure="true"    
  3.            acceptCount="100"    
  4.            useURIValidationHack="false" disableUploadTimeout="true"    
  5.            clientAuth="false" sslProtocol="TLS"      
  6.            keystoreFile="server.keystore"      
  7.            keystorePass="changeit"/> 

Tomcat 5.5.9 Configuration

 
 
  1. <Connector port="8443" maxHttpHeaderSize="8192"    
  2.            maxThreads="150" minSpareThreads="25" maxSpareThreads="75"    
  3.            enableLookups="false" disableUploadTimeout="true"    
  4.            acceptCount="100" scheme="https" secure="true"    
  5.            clientAuth="false" sslProtocol="TLS"      
  6.            keystoreFile="server.keystore"      
  7.            keystorePass="changeit"/> 

Tomcat 5.5.20/5.5.34 Configuration

 
 
  1. <Connector port="8443" protocol="org.apache.coyote.http11.Http11Protocol" SSLEnabled="true" 
  2.        maxThreads="150" scheme="https" secure="true" 
  3.        clientAuth="false" sslProtocol="TLS" 
  4.         keystoreFile="d:/mykeystore " 
  5.        keystorePass="changeit"/> 

Configure tomcat 6.0

 
 
  1. <Connector protocol="org.apache.coyote.http11.Http11NioProtocol"    
  2.            port="8443" minSpareThreads="5" maxSpareThreads="75"    
  3.            enableLookups="true" disableUploadTimeout="true"      
  4.            acceptCount="100"  maxThreads="200"    
  5.            scheme="https" secure="true" SSLEnabled="true"    
  6.            clientAuth="false" sslProtocol="TLS"    
  7.            keystoreFile="D:/tools/apache-tomcat-6.0.10/server.keystore"      
  8.            keystorePass="changeit"/> 

For tomcat5.5.20 and tomcat5.5.34 versions, if no

 
 
  1. protocol="org.apache.coyote.http11.Http11Protocol"  

Or write it

 
 
  1. protocol="HTTP/1.1 " 

The following errors will occur:

650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131228/1403303233-0.jpg "/>

Now, we have configured the https for tomcat. Enter

Https: // localhost: 8443/

If the access succeeds, the configuration is successful. The configuration of the cas server and client is described below.

This article from "Qiao Lei's blog learning progress" blog, please be sure to keep this source http://sucre.blog.51cto.com/1084905/683560

Related Article

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.