码迷,mamicode.com
首页 > 其他好文 > 详细

Tomcat 启用 Https

时间:2014-08-21 19:47:44      阅读:148      评论:0      收藏:0      [点我收藏+]

标签:http   java   使用   io   strong   文件   for   new   

  1. 生成 key

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

    # $JAVA_HOME/bin/keytool -genkey -alias tomcat -keyalg RSA
    Enter keystore password:
    Re-enter new password:
    What is your first and last name?
      [Unknown]:  YourName
    What is the name of your organizational unit?
      [Unknown]:  YourOrgUnit
    What is the name of your organization?
      [Unknown]:  YourOrg
    What is the name of your City or Locality?
      [Unknown]:  YourCity
    What is the name of your State or Province?
      [Unknown]:  YourState
    What is the two-letter country code for this unit?
      [Unknown]:  CN
    Is CN=YourName, OU=YourOrgUnit, O=YourOrg, L=YourCity, ST=YourState, C=CN correct?
      [no]:  yes
    
    Enter key password for <tomcat>
            (RETURN if same as keystore password):  
    Re-enter new password:

    特别说明:上边输入的“ 的主密码”,与 keystore 密码一定要相同,否则TOMCAT起不来

  2. 然后将生成的 .keystore 文件 copy 到 $CATALINA_BASE/conf 目录

  3. 编辑 $CATALINA_BASE/conf/server.xml

    打开下面的配置

    <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
                   maxThreads="150" scheme="https" secure="true"
                   clientAuth="false" sslProtocol="TLS"
                   keystoreFile="./conf/.keystore" keystorePass="password"
                   />
    • keystoreFile: 就是刚才创建的证书文件,这里使用的是相对目录,也就是tomcat根目录.
    • keystorePass: 是你创建证书时输入的密码.
  4. 启动 Tomcat

Tomcat 启用 Https,布布扣,bubuko.com

Tomcat 启用 Https

标签:http   java   使用   io   strong   文件   for   new   

原文地址:http://my.oschina.net/sub/blog/305230

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!