Tomcat配置 https SSL证书
来源:互联网 发布:如何成为黑客 知乎 编辑:程序博客网 时间:2024/05/18 03:45
公司网站链接要由原来的http超文本传输协议访问改为https SSl加密传输协议访问。
--->HTTP与HTTPS的区别:HTTP协议传输的数据都是未加密的,也就是明文的,因此使用HTTP协议传输隐私信息非常不安全,为了保证这些隐私数据能加密传输,于是网景公司设计了SSL(Secure Sockets Layer)协议用于对HTTP协议传输的数据进行加密,从而就诞生了HTTPS。简单来说,HTTPS协议是由SSL+HTTP协议构建的可进行加密传输、身份认证的网络协议,要比http协议安全。
(我的域名已经解析过了)我花了一块钱(一年)在爱名网购买了一个Symantec Basic DV 证书。下载证书解压之后是这个样子的:
打开IIS文件夹:
有证书的密码和一个pfx格式的证书。我开始用pfx格式证书来配置一直没成功,就选择了把pfx格式转换成jks格式的证书来配置,成功了。这里就讲jks格式证书的配置。
一、使用java jdk将PFX格式证书转换为JKS格式证书
先切换到pfx证书目录下,执行命令:
keytool -importkeystore -srckeystorewww.dongnaoedu.com_ssl.pfx -destkeystoredomains.jks -srcstoretype PKCS12 -deststoretype JKS
这里要输入密码,就是上面www.dongnaoedu.com_pfx_password.txt文本文件中的密码,3个口令最好都输入这个密码。可以看到文件夹中生成了domains.jks证书
二、配置server.xml
先把domains.jks证书上传到Tomcat的conf文件夹下:
执行命令: cd /usr/tomcat/apache-tomcat-8.5.11/conf
vim server.xml
找到
<!--
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS"/>
-->
去掉注释,修改为:(443为https默认访问端口)
<Connector port="443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
keystoreFile="conf/domains.jks" //证书地址
keystorePass="582629" //证书密钥
clientAuth="false" sslProtocol="TLS" />
为了让http访问自动跳转为https访问这里顺便把这两个标签也改了,
找到
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
修改为:
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="443" />
找到
<Connector port="8009" enableLookups="false" protocol="AJP/1.3" redirectPort="8443" />
修改为:
<Connector port="8009" enableLookups="false" protocol="AJP/1.3" redirectPort="443" />
保存退出。
三、配置web.xml
执行命令: vim web.xml
在该文件</welcome-file-list>标签(一般在文件最末尾)后面加上这样一段:
<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>
保存退出。所有配置完毕。重启Tomcat即可。证书生效,并且http访问会自动转为https访问。
- Tomcat配置 https SSL证书
- Tomcat配置https的SSL证书
- 服务器tomcat配置SSL证书(https)
- Tomcat ssl 证书 支持https
- tomcat服务器上https的SSL证书安装配置
- Nginx + Tomcat HTTPS/SSL 配置方法 ——申请证书
- Tomcat https的SSL证书安装配置指南
- Tomcat 配置阿里的ssl安全证书,实现https访问
- Tomcat配置Https (SSL)
- tomcat配置ssl,https
- tomcat8 https ssl证书配置
- tomcat https 证书配置
- tomcat配置https证书
- https\SSL安全证书配置,Tomcat、nodejs、Nginx服务器安全证书配置
- 【Tomcat】Tomcat配置https证书
- Tomcat生成https+ssl双向证书认证
- 配置tomcat ssl证书问题
- Tomcat 8.5 配置 SSL 证书
- tcp状态转移
- Linux内核引导代码分析
- 1. Docker启示录
- 二分查找法
- C++如何确保输出的小数位数——以计算加权平均值为例
- Tomcat配置 https SSL证书
- Anaconda
- Creating cluster [ERR] Node 127.0.0.1:7001 is not configured as a cluster node.
- 算法(3.4 散列表)
- 51nod1127-尺取法-最短的包括字符串
- Tekla.Structures.v2017 1DVD
- 文章标题
- [LeetCode]19. Remove Nth Node From End of List
- Codeforces Round #237 (Div. 2) 404B Marathon【精度】 好题!!!!