zoukankan      html  css  js  c++  java
  • Tomcat配置https

    下载证书文件可获得 Tomcat 文件夹,其中有密钥库 www.domain.com.jks。

    证书安装

    配置SSL连接器,将 www.domain.com.jks 文件存放到 conf 目录下,然后配置同目录下的 server.xml 文件:

     <Connector port="443" protocol="HTTP/1.1" SSLEnabled="true"
        maxThreads="150" scheme="https" secure="true"
        keystoreFile="conf/www.domain.com.jks"
        keystorePass="changeit"
        clientAuth="false" sslProtocol="TLS" />
    

    HTTP自动跳转HTTPS的安全配置

    找到 conf 目录下的 web.xml 文件, 在该文件的 下面,添加以下内容:

     <login-config>
        <!-- Authorization setting for SSL -->
        <auth-method>CLIENT-CERT</auth-method>
        <realm-name>Client Cert Users-only Area</realm-name>
        </login-config>
        <security-constraint>
        <!-- Authorization setting for SSL -->
        <web-resource-collection>
        <web-resource-name>SSL</web-resource-name>
        <url-pattern>/*</url-pattern>
        </web-resource-collection>
        <user-data-constraint>
        <transport-guarantee>CONFIDENTIAL</transport-guarantee>
        </user-data-constraint>
        </security-constraint>
    

    为了让非 SSL 的 connector 可以跳转到 SSL 的 connector 中,还需要前往 server.xml 进行配置:

     <Connector port="8080" protocol="HTTP/1.1"
        connectionTimeout="20000"
        redirectPort="443" />
    

    redirectPort 改成 SSL 的 connector 的端口443,重启后便会生效。

  • 相关阅读:
    cmd 一键获取 所有连接过的wifi 密码
    MYSQL注入语句
    Web安全篇之SQL注入攻击
    Kali Linux 不能联网上网 解决方法
    php杂项
    laravel下的数据序列化
    填充数据
    css
    array
    GD库常用函数
  • 原文地址:https://www.cnblogs.com/manastudent/p/12264279.html
Copyright © 2011-2022 走看看