cloud.tencent.com
为例。tomcat-9.0.56
为例。名称 | 说明 |
服务器的 IP 地址 | 服务器的 IP 地址,用于 PC 连接到服务器。 |
用户名 | 登录服务器的用户名。 |
密码 | 登录服务器的密码。 |
cloud.tencent.com
证书文件包到本地目录。
解压缩后,可获得相关类型的证书文件。其中包含 cloud.tencent.com_jks
文件夹:cloud.tencent.com_jks
cloud.tencent.com.jks
密钥库keystorePass.txt
密码文件(若已设置私钥密码,则无 keystorePass.txt
密码文件)cloud.tencent.com.jks
密钥库文件拷贝至 Tomcat 安装目录 conf
目录下。conf
目录下的 server.xml
文件。添加如下内容:<Connector port="443" protocol="HTTP/1.1" SSLEnabled="true"maxThreads="150" scheme="https" secure="true"#证书保存的路径keystoreFile="Tomcat 安装目录/conf/cloud.tencent.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="Tomcat 安装目录/conf/cloud.tencent.com.jks"keystorePass="******" /><Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /><Engine name="Catalina" defaultHost="cloud.tencent.com"><Realm className="org.apache.catalina.realm.LockOutRealm"><Realm className="org.apache.catalina.realm.UserDatabaseRealm"resourceName="UserDatabase"/></Realm><Host name="cloud.tencent.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>
bin
目录下依次执行以下 bat 脚本,关闭和重启 Tomcat 服务。shutdown.bat (关闭 Tomcat 服务器)startup.bat (启动 Tomcat 服务器)
bin
目录下执行以下 bat 脚本,启动 Tomcat 服务。startup.bat
https://www.tencentcloud.com/
进行访问。conf
目录下的 web.xml
文件,并找到 </welcome-file-list> 标签。<login-config><!-- Authorization setting for SSL --><auth-method>CLIENT-CERT</auth-method><realm-name>Client Cert Users-only Area</realm-name></login-config><security-constraint><!-- Authorization setting for SSL --><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>
server.xml
文件,将 redirectPort 参数修改为 SSL 的 connector 的端口,即443端口。如下所示:<Connector port="80" protocol="HTTP/1.1"connectionTimeout="20000"redirectPort="443" />
/bin
目录下执行执行以下 bat 脚本,关闭 Tomcat 服务器。shutdown.bat
configtest.bat
https://www.tencentcloud.com/
进行访问。startup.bat
本页内容是否解决了您的问题?