如何在Tomcat中配置SSL证书


本文摘自PHP中文网,作者不言,侵删。

我们假设已经在系统中安装了Tomcat服务器。如果没有,可以在CentOS、Rhel或Ubuntu、Debian系统上安装Tomcat7。本篇文章既可用于Linux,也可用于Windows主机,我们唯一需要更改的是KeyStore的目录路径。

步骤1:创建密钥库

Java KeyStore(JKS)是安全证书的存储库。keytool是用于创建和管理密钥库的命令行实用程序。JDK和JRE都可以使用此命令。我们只需要确保JDK或JRE配置了PATH环境变量。

1

$ keytool -genkey -aliassvr1.tecadmin.net-keyalg RSA -keystore/etc/pki/keystore

输出:

1

2

3

4

5

6

7

8

9

10

11

Enter keystore password:

Re-enter new password:

What is your first and last name?

  [Unknown]:Rahul KumarWhat is the name of your organizational unit?

  [Unknown]:WebWhat is the name of your organization?

  [Unknown]:TecAdmin Inc.What is the name of your City or Locality?

  [Unknown]:DelhiWhat is the name of your State or Province?

  [Unknown]:DelhiWhat is the two-letter country code for this unit?

  [Unknown]:INIs CN=Rahul Kumar, OU=Web, O=TecAdmin Inc., L=Delhi, ST=Delhi, C=IN correct?

  [no]:yesEnter key password for(RETURN if same as keystore password):

Re-enter new password:

步骤2:获取CA签名的SSL[忽略自签名用户]

如果要使用自签名SSL证书,则无需执行此步骤。如果要从证书颁发机构购买有效的ssl,则需要先创建CSR,使用以下命令执行此操作。

创建CSR:

1

$ keytool -certreq -keyalg RSA -alias svr1.tecadmin.net -file svr1.csr -keystore /etc/pki/keystore

上面的命令将提示输入密钥库密码并生成CSR文件。使用此CSR并从任一证书颁发机构购买ssl证书。

阅读剩余部分

相关阅读 >>

ssm分页的方法介绍(代码示例)

如何在tomcat中配置ssl证书

linux安装jdk和tomcat以及mysql的图文教程

更多相关阅读请进入《tomcat》频道 >>


数据库系统概念 第6版
书籍

数据库系统概念 第6版

机械工业出版社

本书主要讲述了数据模型、基于对象的数据库和XML、数据存储和查询、事务管理、体系结构等方面的内容。



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...