星空网 > 软件开发 > 操作系统

Godaddy SSL 安装及Tomcat 7配置

基础环境:Centos 7.X

1. 安装tomcat 与java 环境;

2.使用jre 程序的keytool 生成密钥,java 我使用解压版本并运行目录在/usr/java,

生成tomcat.keystore 密钥文件;

1 /usr/java/jre/bin/keytool -keysize 2048 -genkey -alias tomcat -keyalg RSA -keystore tomcat.keystore

然后会提示输入DNS 信息及密码:

Enter keystore password: 设置一个用于保护你keystore文件的密码,例如123456Re-enter new password: 重复上面的密码What is your first and last name? [Unknown]: yourdomain.com 输入你网站的域名,注意Godaddy的证书一个只能签名一个域名,也就是说 baidu.com 和 www.baidu.com 不是同一个域名,这里应该填写你准备签名的那一个域名。What is the name of your organizational unit? [Unknown]: Networking 组织单位名称(随便)What is the name of your organization? [Unknown]: yourdomain.com 组织名称(随便)What is the name of your City or Locality? [Unknown]: Guangzhou 所在城市(随便)What is the name of your State or Province? [Unknown]: Guangdong 所在省份(随便)What is the two-letter country code for this unit? [Unknown]: CN 所在国家的两位代号(随便)Is CN=www.yourdomain.com, OU=Networking, O=yourdomain.com, L=Shenzhen, ST=Guangdong, C=CN correct? [no]: yes 以上信息正确则输入yesEnter key password for  (RETURN if same as keystore password): 输入前面的keystore 密码

3.使用keytool 通过tomcat.keystore 生成csr文件,csr.csr 是csr的文件,提前的csr 名称可以自定义;

Godaddy SSL 安装及Tomcat 7配置images/loading.gif' data-original="http://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif" >Godaddy SSL 安装及Tomcat 7配置
1 /usr/java/jre/bin/keytool -certreq -keyalg RSA -alias tomcat -file csr.csr -keystore tomcat.keystore

Generate csr

4.官方申请证书;

登录到你购买 SSL 证书商(这里是 GoDaddy),根据提示进入输入 CSR  的页面,用文本编辑器打开刚才生成的 csr.csr 文件,把里面的文本内容复制粘贴到页面的表单里即可。SSL 证书商会根据你的域名发送一封验证邮件到域名注册者的Email(所以你要提前注意你的域名注册的Email地址是什么,如果是错误的话需要先修正,否则收不到验证Email)。这个过程可能需要几分钟或者几小时,收到验证Email之后点击里面的链接地址就完成私钥签名了;

5.将官方生成的证书导入到 tomcat.keystore 里面;

登录到你购买 SSL 的证书商,下载你的网站已签名的证书文件,在 GoDaddy 里你下载会得到一个压缩包,里面放有(domain.crt,gd_bundle-g2-g1.crt,gdig2.crt)

导入的流程顺序:根证书,中级证书,个人证书;

我所下载的包里面包含:(f91dc12f8b1fb94e.crt,gd_bundle-g2-g1.crt,gdig2.crt)

所以根证书是:gd_bundle-g2-g1.crt   中级证书:gdig2.crt  个人证书:f91dc12f8b1fb94e.crt

请注意:在默认安装证书时,到最后安装个人证书会提示:keytool error: java.lang.Exception: Failed to establish chain from reply

解决方法:原因是官方下载的根证书与中级证书可能是过期,你到它的repository里找到对应名称的根证书下载覆盖


 

6.导入证书:

1 usr/java/jre/bin/keytool -import -alias root -keystore tomcat.keystore -trustcacerts -file gd_bundle-g2-g1.crt2 中级证书3 /usr/java/jre/bin/keytool -import -alias intermed -keystore tomcat.keystore -trustcacerts -file gdig2.crt 4 个人证书5 /usr/java/jre/bin/keytool -import -alias tomcat -keystore tomcat.keystore -trustcacerts -file f91dc12f8b1fb94e.crt 

 

7.tomcat 配置server.

 1 <Service name="CatalinaApp"> 2     <Connector port="443" protocol="org.apache.coyote.http11.Http11Protocol" 3         maxThreads="150" SSLEnabled="true" scheme="https" secure="true" 4         clientAuth="false" sslProtocol="TLS"  5         keystoreFile="/usr/local/tomcat/ssl/tomcat.keystore" 6         keystorePass="keystore密码"/> 7  8     <Connector port="8011" protocol="AJP/1.3" redirectPort="8443" /> 9     <Engine name="CatalinaApp" defaultHost="localhost">10     <Realm className="org.apache.catalina.realm.LockOutRealm">11     <Realm className="org.apache.catalina.realm.UserDatabaseRealm"12         resourceName="UserDatabase"/>13     </Realm>14 15     <Host name="localhost" appBase="/var/APP/"16       unpackWARs="true" autoDeploy="true">17     <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"18         prefix="APP_access_log." suffix=".txt"19         pattern="%h %l %u %t &quot;%r&quot; %s %b" />20 21    </Host>22   </Engine>23  </Service>

 

8.启动tomcat,添加防火墙端口,测试




原标题:Godaddy SSL 安装及Tomcat 7配置

关键词:tomcat

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流