https://help.aliyun.com/knowledge_detail/95505.html?spm=5176.11065259.1996646101.searchclickresult.61c120e0jR0LgY

Tomcat 证书部署

a.    配置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"

/>

说明

clientAuth如果设为true,表示Tomcat要求所有的SSL客户出示安全证书,对SSL客户进行身份验证

keystoreFile指定keystore文件的存放位置,可以指定绝对路径,也可以指定相对于 (Tomcat安装目录)环境变量的相对路径。如果此项没有设定,默认情况下,Tomcat将从当前操作系统用户的用户目录下读取名为 “.keystore”的文件。

keystorePass密钥库密码,指定keystore的密码。(如果申请证书时有填写私钥密码,密钥库密码即私钥密码)

sslProtocol指定套接字(Socket)使用的加密/解密协议,默认值为TLS

b.    http自动跳转https的安全配置

到conf目录下的web.xml。在</welcome-file-list>后面,</web-app>,也就是倒数第二段里,加上这样一段

<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>

这步目的是让非ssl的connector跳转到ssl的connector去。所以还需要前往server.xml进行配置:

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

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

禁用http请求

<security-constraint>
<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>

<Connector port="80" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="443" URIEncoding="UTF-8"/>

<Connector URIEncoding="UTF-8"
port="443"
protocol="HTTP/1.1"
SSLEnabled="true"
maxThreads="150"
scheme="https"
secure="true"
keystoreFile="./conf/SHA256withRSA_www.xymapp.cn.jks"
keystorePass="K7UbunvlKdad"
clientAuth="false"
SSLProtocol="TLSv1+TLSv1.1+TLSv1.2"
ciphers="TLS_RSA_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_256_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_256_CBC_SHA256"
/>

配置https域名的更多相关文章

  1. nginx配置https域名

    nginx安装配置支持https和配置https域名 yum install -y gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-de ...

  2. [从零开始搭网站六]为域名申请免费SSL证书(https),并为Tomcat配置https域名所用的多SSL证书

    点击下面连接查看从零开始搭网站全系列 从零开始搭网站 由于国内的网络环境比较恶劣,运营商流量劫持的情况比较严重,一般表现为别人打开你的网站的时候会弹一些莫名其妙的广告...更过分的会跳转至别的网站. ...

  3. 使用halo搭建自己的博客并配置https域名访问

    首先进行java配置 # 1. 下载jdk [下载地址](https://www.oracle.com/cn/java/technologies/javase-downloads.html) - 一定 ...

  4. Nginx配置同一个域名同时支持http与https两种方式访问

    Nginx配置同一个域名http与https两种方式都可访问,证书是阿里云上免费申请的 server{listen 80;listen 443 ssl;ssl on;server_name 域名;in ...

  5. 配置tomcat的https域名

    配置tomcat的https域名: <Connector port=" protocol="org.apache.coyote.http11.Http11NioProtoco ...

  6. 腾讯云域名申请+ssl证书申请+springboot配置https

    阿里云域名申请 域名申请比较简单,使用微信注册阿里云账号并登陆,点击产品,选择域名注册 输入你想注册的域名 进入域名购买页面,搜索可用的后缀及价格,越热门的后缀(.com,.cn)越贵一般,并且很可能 ...

  7. 网站配置https(腾讯云域名操作)

    我们都知道http协议是超文本传输协议,早期的网站使用的都是http,但是并不安全,数据在传输过程中容易被拦截篡改.所以后面有了https,也就是经过ssl加密的http协议.本文主要对网站配置htt ...

  8. phpcms站点域名配置https无法提交如何处理

    一位网友给ytkah反映说phpcms站点域名配置https无法提交,在后台修改站点域名为https提交后提示“站点域名格式应该为http://www.phpcms.cn/,请以‘/’结束”,这个要如 ...

  9. [转帖]在 k8s 中自动为域名配置 https

    在 k8s 中自动为域名配置 https https://juejin.im/post/5db8d94be51d4529f73e2833 随着 web 的发展,https 对于现代网站来说是必不可少的 ...

随机推荐

  1. 【洛谷P1101】单词方阵

    题目大意:给一 \(n \times n\) 的字母方阵,内可能蕴含多个 \("yizhong"\) 单词.单词在方阵中是沿着同一方向连续摆放的.摆放可沿着 8 个方向的任一方向, ...

  2. HDU 2255 KM算法 二分图最大权值匹配

    奔小康赚大钱 Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Subm ...

  3. 鸟哥的Linux私房菜——第十二章:档案的压缩与打包

    视频链接: 土豆:http://www.tudou.com/programs/view/GncwT0FJKsQ B站(推荐):http://www.bilibili.com/video/av98857 ...

  4. bzoj千题计划188:bzoj1923: [Sdoi2010]外星千足虫 (高斯—若尔当消元法解异或方程组)

    http://www.lydsy.com/JudgeOnline/problem.php?id=1923 #include<cstdio> #include<cstring> ...

  5. 蓝桥杯 大臣的旅费_树的最长度_两次DFS

    #include <iostream> #include <cstdio> #include <cstdlib> #include <algorithm> ...

  6. FFprobe使用指南

    http://blog.csdn.net/stone_wzf/article/details/45378759 http://blog.chinaunix.net/uid-26000296-id-42 ...

  7. [iOS]@synthesize和@dynamic关键字

    首先讲@property, 这是iOS6以后出来的关键词. 用它声明一个属性之后, 编译器会自动给你生成setter和getter方法的声明以及实现还有一个以_xxx 的成员变量(xxx是你属性定义的 ...

  8. 使用WebHelper调用Asp.net WebAPI

    1.WebHelper using System; using System.Collections.Generic; using System.Collections.Specialized; us ...

  9. 一些javascript的工具书

    http://pan.baidu.com/s/1jGj9CvO

  10. ViewGroup.layout(int l, int t, int r, int b)四个输入参数的含义

    ViewGroup.layout(int l, int t, int r, int b)这个方法是确定View的大小和位置的,然后将其绘制出来,里面的四个参数分别是View的四个点的坐标,他的坐标不是 ...