tomcat https

http://www.oschina.net/question/54100_55374 wrote
tomcat https

 In this simple tutorial we can enable HTTPS access in Tomcat 7 in two easy steps.

Step 1: Create a .keystore file

Use the following command to generate the .keystore file

windows :

?
1
%JAVA_HOME%\bin\keytool -genkey - alias tomcat -keyalg RSA

 

Linux:

?
1
$JAVA_HOME /bin/keytool -genkey - alias tomcat -keyalg RSA

 

Step 2: Enable the  SSL HTTP/1.1 connector in server.xml (already configured, just remove the comment), port 8443

Modify the $CATALINA_HOME/conf/server.xml file:

?
1
2
3
4
< Connector port = "8443" protocol = "HTTP/1.1" SSLEnabled = "true"
               maxThreads = "150" scheme = "https" secure = "true"
               clientAuth = "false" sslProtocol = "TLS"
               keystoreFile = "${user.home}/.keystore" keystorePass = "123@com" />

 

"keystorePass" is the password to generate the .keystore file, then restart Tomcat

Open the browser and visit the following address: https://localhost:8443

If you see the home page of Tomcat, you are done.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326670507&siteId=291194637