Original article: blog.ouyangsihai.cn >> the Java development background Tomcat add https support applet development process
)
1 to apply for their own domain name certificate
Note : If the application is not in a good domain name registration Tencent, does not automatically pass, that require manual validation, verification method is as follows: https: //cloud.tencent.com/document/product/400/6814
After successful authentication, a certificate will be issued to you.
2 to the Tomcat installation https certificate
Steps
Reference document: https: //cloud.tencent.com/document/product/400/4143
Certificate Installation
- SSL certificate has been downloaded in the Administration Console and unzip
www.domain.com
the certificate package to a local directory.
After unpacking, obtain the relevant certificate file types. Which contains the Tomcat folders and CSR file:- Folder name : Tomcat
- Folder Contents :
www.domain.com.jks
KeystorekeystorePass.txt
Password file (if you have set the private key password, nokeystorePass.txt
password file)
- CSR contents of the file :
www.domain.com.csr
file
> 说明:
>
> CSR 文件是申请证书时由您上传或系统在线生成的,提供给 CA 机构。安装时可忽略该文件。复制代码
- Log Tomcat server using the "WinSCP" (ie tool to copy files between local and remote computers).
- You will have acquired
www.domain.com.jks
key store file copied from a local directory to/usr/*/conf
the directory. - Telnet Tomcat server. For example, using "PuTTY" tool login.
- Edited
/usr/*/conf
directory of theserver.xml
file. Add the following:
<Connector port="443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
keystoreFile="/usr/*/conf/www.domain.com.jks" #证书保存的路径
keystorePass="******"#密钥库密码
clientAuth="false"/>复制代码
详细 `server.xml` 文件请参考如下内容:复制代码
<?xml version="1.0" encoding="UTF-8"?>
<Server port="8005" shutdown="SHUTDOWN">
<Listener className="org.apache.catalina.startup.VersionLoggerListener" />
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
<GlobalNamingResources>
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
pathname="conf/tomcat-users.xml" />
</GlobalNamingResources>
<Service name="Catalina">
<Connector port="80" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />
<Connector port="443" protocol="HTTP/1.1"
maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
clientAuth="false"
keystoreFile="/usr/*/conf/www.domain.com.jks"
keystorePass="******" />
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
<Engine name="Catalina" defaultHost=“www.domain.com">
<Realm className="org.apache.catalina.realm.LockOutRealm">
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>
</Realm>
<Host name=“www.domain.com" appBase="webapps"
unpackWARs="true" autoDeploy="true" >
<Context path="" docBase ="Knews" />
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log" suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" />
</Host>
</Engine>
</Service>
</Server>复制代码
配置文件的主要参数说明如下:
* **keystoreFile**:密钥库文件的存放位置,可以指定绝对路径,也可以指定相对于 <CATALINA_HOME> (Tomcat安装目录)环境变量的相对路径。如果此项没有设定,默认情况下,Tomcat 将从当前操作系统用户的用户目录下读取名为 “.keystore” 的文件。
* **keystorePass**:密钥库密码,指定 keystore 的密码。申请证书时若设置了私钥密码,请填写私钥密码;若申请证书时未设置私钥密码,请填写 Tomcat 文件夹中 keystorePass.txt 文件的密码。
* **clientAuth**:如果设为 true,表示 Tomcat 要求所有的 SSL 客户出示安全证书,对 SSL 客户进行身份验证。复制代码
After the restart Tomat, to complete!
Articles have inappropriate, please correct me, if you like micro-letters to read, you can also concerned about my micro-channel public number : ,
好好学java
access to quality learning resources.