最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
详解如何给Tomcat配置Https/ssl证书
时间:2022-06-30 17:35:33 编辑:袖梨 来源:一聚教程网
如果需要给Tomcat开启Https,首先我们需要一个证书,下面演示如何创建。
创建证书
keytool -genkeypair -alias "tomcat" -keyalg "RSA" -keystore "localhost-rsa.jks"
后面的信息随便输入,我这里输入的是:
Enter keystore password: Re-enter new password: What is your first and last name? [Unknown]: pich What is the name of your organizational unit? [Unknown]: pich What is the name of your organization? [Unknown]: tomcat What is the name of your City or Locality? [Unknown]: beijing What is the name of your State or Province? [Unknown]: beijing What is the two-letter country code for this unit? [Unknown]: cn Is CN=pich, OU=pich, O=tomcat, L=beijing, ST=beijing, C=cn correct? [no]: y Enter key password for(RETURN if same as keystore password): Re-enter new password:
这样就会在当前目录创建一个localhost-rsa.jks文件。密码是123456,别名是tomcat。
给Tomcat配置证书
首先将上面生成的localhost-rsa.jks文件拷贝到Tomcat的conf目录,然后打开该目录下面的server.xml文件,找到如下代码,原来是注释了,现在需要打开注释更改为如下内容:
然后重新启动Tomcat,访问https://loc*alh**ost:8443/
就可以看到如下页面:
可以看到地址栏是显示为不安全的。因为这个证书是我们自己制作的,浏览器默认不信任他,当然你可以手动信任他。12306他们的证书差不多就是这样制作的。
相关文章
- 九牧之野董卓反击盾阵容玩法攻略 12-15
- TikTok国际版官网下载入口-安全访问全球版TikTok 12-15
- 新三国志曹操传马超无双试炼四通关攻略 12-15
- 俄罗斯YANDEX引擎官网入口-免登录直达Yandex首页 12-15
- 漫蛙ManWa在线免费阅读入口_漫蛙ManWa官方网页版一键直达 12-15
- 逃离鸭科夫仓库区地窖在哪 仓库区地窖入口位置详情 12-15