cloud.tencent.com
is used as an example.tomcat-9.0.56
version is used as an example.443
on the Tomcat server so that HTTPS can be enabled after the certificate is installed. For more information, see How Do I Enable Port 443 for a VM?Name | Description |
Server IP address | IP address of the server, which is used to connect the PC to the server. |
Username | The username used to log in to the server. |
Password | The password used to log in to the server. |
.jks
certificate./usr
directory by default. For example, if the Tomcat folder is Tomcat-9.0.56
, the configuration file directory will be /usr/Tomcat-9.0.56/conf
./usr
directory by default. For example, if the Tomcat folder is Tomcat-9.0.56
, the configuration file directory will be /usr/Tomcat-9.0.56/conf
.cloud.tencent.com
certificate file package to the local directory.
After decompression, you can get the certificate file of the corresponding type, which includes the cloud.tencent.com_jks
folder.cloud.tencent.com_jks
cloud.tencent.com.jks
: keystore filekeystorePass.txt
: password file (if you have set a private key password, this file will not be generated)cloud.tencent.com.jks
keystore file from the local directory to the /usr/Tomcat-9.0.56/conf
directory of the Tomcat configuration file.server.xml
file in the /usr/Tomcat-9.0.56/conf
directory:<Connector port="443" protocol="HTTP/1.1" SSLEnabled="true"maxThreads="150" scheme="https" secure="true"# Path of the certificatekeystoreFile="Tomcat installation directory/conf/cloud.tencent.com.jks"# Keystore passwordkeystorePass="******"clientAuth="false"/>
.keystore
from the user directory of the current OS user.keystorePass.txt
file in the Tomcat folder.server.xml
file, see below:server.xml
file; otherwise, the format will be incorrect.<?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 installation directory/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
directory (for example, /usr/Tomcat-9.0.56/bin
) of the Tomcat installation directory../shutdown.sh (Shut down the Tomcat service)./startup.sh (Start the Tomcat service)
bin
directory (for example, /usr/Tomcat-9.0.56/bin
) of the Tomcat installation directory../startup.sh
https://cloud.tencent.com
.web.xml
file in the conf
directory (for example, /usr/Tomcat-9.0.56/conf
) of the Tomcat installation directory and find the </welcome-file-list>
tag.</welcome-file-list>
and add the following:<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
file in the conf
directory (for example, /usr/Tomcat-9.0.56/conf
) of the Tomcat installation directory by changing the redirectPort
parameter to the port of the SSL connector, i.e., port 443
, as shown below:<Connector port="80" protocol="HTTP/1.1"connectionTimeout="20000"redirectPort="443" />
/bin
directory (for example, /usr/Tomcat-9.0.56/bin
) of the Tomcat installation directory../shutdown.sh
./configtest.sh
http://cloud.tencent.com
../startup.sh
Was this page helpful?