Centos里的tomcat开启https接口
2017-09-12 14:17
225 查看
1.静默安装tomcat
yum install tomcat
2.安装tomcat的web管理包
yum install tomcat-webapps tomcat-admin-webapps
3.生成证书 (将 localhost 换成 ip)
keytool -genkey -v -alias tomcat -keyalg RSA -validity 3650 -keystore tomcat.keystore -dname "CN=localhost,OU=cn,O=cn,L=cn,ST=cn,c=cn" -storepass 123456 -keypass 123456
4.修改 tomcat 配置
cd /usr/share/tomcat/conf
vi server.xml
增加如下内容 (其实 server.xml里面已经有,不过被注释了)
<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol" maxThreads="150" SSLEnabled="true" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" keystoreFile="/usr/share/tomcat/conf/tomcat.keystore" keystorePass="123456" truststoreFile="/usr/share/tomcat/conf/tomcat.keystore" truststorePass="123456"/>
5.将证书变为可以在 windows 环境下安装的 cre文件
keytool -export -alias tomcat -file file.cer -keystore tomcat.keystore -validity 36500
6.然后将证书拷贝到 windows桌面.
7.双击安装 file.cer文件
8.配置http重定向到https
在 /usr/share/tomcat/conf/web.xml中加入<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>
9.使用命令 service tomcat start 命令启动.
10.打开 IE浏览器,输入 https://ip 访问
.弹出的阻止页面选择不安全继续浏览.题外话: http默认端口是80,https默认端口是443.
相关文章推荐
- 开启tomcat的SSL(https)支持
- Centos下搭建 tomcat https服务器详解(原创)
- CAS 单点登录 - Cas Server 下载、部署、测试 与 Tomcat 7.0 开启 Https
- centos7.2下tomcat7实现https
- ios访问tomcat接口时配置https
- centos中tomcat配置ssl,用于iphone手机https下载自动安装
- Centos 6.9 配置 Tomcat 9 https
- Tomcat的https配置及双接口配置
- tomcat+https协议的接口编写及客户端访问
- centos 安装mysql 无法登陆 Tomcat配置HTTPS报错解决方法
- centos+tomcate + https协议 SSL证书制作、部署支持iphone、ipa下载安装.ipa程序
- 一分钟开启Tomcat https支持
- tomcat开启https
- tomcat7 开启https协议
- tomcat开启https
- Centos下搭建 tomcat https服务器详解(原创)
- tomcat 开启https 配置keystore
- apache2 tomcat https配置-被忽悠进了CentOS 6
- 一分钟开启Tomcat https支持
- Linux+Nginx/Apache/Tomcat新增SSL证书,开启https访问教程