zoukankan      html  css  js  c++  java
  • tomcat7 配置 https安全访问

    在apache-tomcat-7.0.33-windows-x64.zip配置https,结果在配置SSL时遇到一些问题

    1、用JDK自带的keytool来生成私有密钥和自签发的证书,如下: 

    keytool -genkey -alias sdtx -keyalg RSA -keystore d:/keys/sdtx.keystore

    2、启用Web服务器(Tomcat)的SSL,也就是HTTPS加密协议,准备好一个干净的tomcat,本教程使用的apache-tomcat-7.0.33-windows-x64 打开tomcat目录的conf/server.xml文件,开启83和87行的注释代码,并设置keystoreFile、keystorePass修改结果如下:

    <Connector port="8443" protocol="org.apache.coyote.http11.Http11Protocol"
                   maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
                   clientAuth="false" sslProtocol="TLS" keystoreFile="D:/test/sdtx.keystore"
                   keystorePass="123456"/>

    3、怎样配置Java Web程序使用HTTPS

    如果想要你的JavaEE Web程序使用HTTPS协议实现SSL通信,你需要在web.xml配置文件中添加:

        <security-constraint>
          <web-resource-collection>
            <web-resource-name>app</web-resource-name>
            <url-pattern>/*</url-pattern>
          </web-resource-collection>
          <user-data-constraint>
            <transport-guarantee>CONFIDENTIAL</transport-guarantee>
          </user-data-constraint>
        </security-constraint>
  • 相关阅读:
    装饰器
    函数对象与闭包
    名称空间与作用域
    函数的参数
    函数的基本使用
    ${}与#{}的区别
    thymeleaf之日期格式化
    template might not exist or might not be accessible by any of the configured Template Resolvers
    springboot使用@Scheduled之cron表达式详解
    自定义springboot项目启动图案
  • 原文地址:https://www.cnblogs.com/qixing/p/tomcat7.html
Copyright © 2011-2022 走看看