zoukankan      html  css  js  c++  java
  • tomcat7支持https配置

    基本环境:centos7.0   jdk1.8  tomcat7

    1.下载tomcat,解压到指定目录
    例如:/home/test/apache-tomcat-7.0.81
    2.生成证书
     首先进入JAVA_HOME的bin目录下输入如下代码:
          cd /usr/java/jdk1.8.0_121/bin/
          keytool -genkey -alias tomcat -keyalg RSA -keystore /home/test/apache-tomcat-7.0.81/tomcat.keystore -validity 36500 
    /home/test/apache-tomcat-7.0.81/tomcat.keystore 指定证书的保存路径,后续配置会使用)
      Enter keystore password: #此处需要输入大于或等于6个字符的字符串
          Re-enter new password:
          What is your first and last name? #“您的名字与姓氏是什么?”这是必填项, 
          [Unknown]: haha
          What is the name of your organizational unit? #“你的组织单位名称是什么?”可以按照需要填写也可以不填写直接回车,实验中直接回车
          [Unknown]:
          What is the name of your organization? #“您的组织名称是什么?”,同上直接回车
          [Unknown]:
          What is the name of your City or Locality? #“您所在城市或区域名称是什么?同上直接回车
          [Unknown]:
          What is the name of your State or Province? #“您所在的州或者省份名称是什么?”
          [Unknown]:
      What is the two-letter country code for this unit? #“该单位的两字母国家代码是什么?”
          [Unknown]:
          Is CN=10.15.24.254, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=Unknown correct? #系统询问“正确 吗?”时,对照    输入信息,如果符合要求则使用键盘输入字母“y”,否则输入“n”重新填写上面的信息
      [no]: y
          Enter key password for
          RETURN if same as keystore password): #输入的主密码,这项较为重要,会在tomcat配置文件中使用,建议输入与keystore的密码一致,设置其它密码也可以
          Re-enter new password:
     
    3.修改tomcat的server.xml配置文件,使其支持https
      cd /home/test/apache-tomcat-7.0.81
         vi config/server.xml
     增加https的节点配置,https的配置默认是被注释的,取消注释,然后指定生成的keystore证书文件路径和证书秘钥
     
    4.开启8443端口
     vim /etc/sysconfig/iptables 进入端口设置文件编辑状态,添加一行
     
    重启防火墙
    systemctl restart firewalld.service
     
    5.重启tomcat,在浏览器输入https://ip:8443 验证即可
  • 相关阅读:
    shell 10流程控制
    shell 9test命令
    shell 8字符串与文件内容处理
    shell 7输入输出
    shell 6基本运算符
    JS-JQ实现TAB选项卡
    JS-JQ实现页面滚动时元素智能定位(顶部-其他部位)
    js获取框架(IFrame)的内容
    codeforces 660C C. Hard Process(二分)
    codeforces 660B B. Seating On Bus(模拟)
  • 原文地址:https://www.cnblogs.com/cowboys/p/7607451.html
Copyright © 2011-2022 走看看