cloud.tencent.com
为例。jetty-distribution-9.4.28.v20200408
为例。名称 | 说明 |
服务器的 IP 地址 | 服务器的 IP 地址,用于 PC 连接到服务器。 |
用户名 | 登录服务器的用户名。 |
密码 | 登录服务器的密码。 |
/usr/local/jetty
目录下。cloud.tencent.com
证书文件包到本地目录。
解压缩后,可获得相关类型的证书文件。其中包含 cloud.tencent.com_jks
文件夹:cloud.tencent.com_jks
cloud.tencent.com.jks
密钥库keystorePass.txt
密码文件(若已设置私钥密码,则无 keystorePass.txt
密码文件)/usr/local/jetty/jetty-distribution-9.4.28.v20200408/etc
目录下执行命令 mkdir cert
创建 cert 文件夹。cloud.tencent.com.jks
密钥库文件从本地目录拷贝至 cert 文件夹。/usr/local/jetty/jetty-distribution-9.4.28.v20200408/etc
目录下的 jetty-ssl-context.xml
文件,如下所示:cloud.tencent.com_jks
文件夹中 keystorePass.txt 文件的密码。cloud.tencent.com_jks
文件夹中 keystorePass.txt 文件的密码。<?xml version="1.0"?><!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_3.dtd"><!-- ============================================================= --><!-- SSL ContextFactory configuration --><!-- ============================================================= --><!--To configure Includes / Excludes for Cipher Suites or Protocols see tweak-ssl.xml example athttps://www.eclipse.org/jetty/documentation/current/configuring-ssl.html#configuring-sslcontextfactory-cipherSuites--><Configure id="sslContextFactory" class="org.eclipse.jetty.util.ssl.SslContextFactory$Server"><Set name="Provider"><Property name="jetty.sslContext.provider"/></Set><Set name="KeyStorePath"><Property name="jetty.base" default="." />/<Property name="jetty.sslContext.keyStorePath" deprecated="jetty.keystore" default="etc/cert/cloud.tencent.com.jks"/></Set><Set name="KeyStorePassword"><Property name="jetty.sslContext.keyStorePassword" deprecated="jetty.keystore.password" default="4d5jtdq238j1l"/></Set><Set name="KeyStoreType"><Property name="jetty.sslContext.keyStoreType" default="JKS"/></Set><Set name="KeyStoreProvider"><Property name="jetty.sslContext.keyStoreProvider"/></Set><Set name="KeyManagerPassword"><Property name="jetty.sslContext.keyManagerPassword" deprecated="jetty.keymanager.password" default="4d5jtdq238j1l"/></Set><Set name="TrustStorePath"><Property name="jetty.base" default="." />/<Property name="jetty.sslContext.trustStorePath" deprecated="jetty.truststore" default="etc/cert/cloud.tencent.com.jks"/></Set><Set name="TrustStorePassword"><Property name="jetty.sslContext.trustStorePassword" deprecated="jetty.truststore.password"/></Set><Set name="TrustStoreType"><Property name="jetty.sslContext.trustStoreType"/></Set><Set name="TrustStoreProvider"><Property name="jetty.sslContext.trustStoreProvider"/></Set><Set name="EndpointIdentificationAlgorithm"><Property name="jetty.sslContext.endpointIdentificationAlgorithm"/></Set><Set name="NeedClientAuth"><Property name="jetty.sslContext.needClientAuth" deprecated="jetty.ssl.needClientAuth" default="false"/></Set><Set name="WantClientAuth"><Property name="jetty.sslContext.wantClientAuth" deprecated="jetty.ssl.wantClientAuth" default="false"/></Set><Set name="useCipherSuitesOrder"><Property name="jetty.sslContext.useCipherSuitesOrder" default="true"/></Set><Set name="sslSessionCacheSize"><Property name="jetty.sslContext.sslSessionCacheSize" default="-1"/></Set><Set name="sslSessionTimeout"><Property name="jetty.sslContext.sslSessionTimeout" default="-1"/></Set><Set name="RenegotiationAllowed"><Property name="jetty.sslContext.renegotiationAllowed" default="true"/></Set><Set name="RenegotiationLimit"><Property name="jetty.sslContext.renegotiationLimit" default="5"/></Set><Set name="SniRequired"><Property name="jetty.sslContext.sniRequired" default="false"/></Set><!-- Example of how to configure a PKIX Certificate Path revocation Checker<Call id="pkixPreferCrls" class="java.security.cert.PKIXRevocationChecker$Option" name="valueOf"><Arg>PREFER_CRLS</Arg></Call><Call id="pkixSoftFail" class="java.security.cert.PKIXRevocationChecker$Option" name="valueOf"><Arg>SOFT_FAIL</Arg></Call><Call id="pkixNoFallback" class="java.security.cert.PKIXRevocationChecker$Option" name="valueOf"><Arg>NO_FALLBACK</Arg></Call><Call class="java.security.cert.CertPathBuilder" name="getInstance"><Arg>PKIX</Arg><Call id="pkixRevocationChecker" name="getRevocationChecker"><Call name="setOptions"><Arg><Call class="java.util.EnumSet" name="of"><Arg><Ref refid="pkixPreferCrls"/></Arg><Arg><Ref refid="pkixSoftFail"/></Arg><Arg><Ref refid="pkixNoFallback"/></Arg></Call></Arg></Call></Call></Call><Set name="PkixCertPathChecker"><Ref refid="pkixRevocationChecker"/></Set>--></Configure>
/usr/local/jetty/jetty-distribution-9.4.28.v20200408/etc
目录下的 jetty-ssl.xml
文件,修改端口为443。如下所示:<Call name="addConnector"><Arg><New id="sslConnector" class="org.eclipse.jetty.server.ServerConnector"><Arg name="server"><Ref refid="Server" /></Arg><Arg name="acceptors" type="int"><Property name="jetty.ssl.acceptors" deprecated="ssl.acceptors" default="-1"/></Arg><Arg name="selectors" type="int"><Property name="jetty.ssl.selectors" deprecated="ssl.selectors" default="-1"/></Arg><Arg name="factories"><Array type="org.eclipse.jetty.server.ConnectionFactory"><!-- uncomment to support proxy protocol<Item><New class="org.eclipse.jetty.server.ProxyConnectionFactory"/></Item>--></Array></Arg><Set name="host"><Property name="jetty.ssl.host" deprecated="jetty.host" /></Set><Set name="port"><Property name="jetty.ssl.port" deprecated="ssl.port" default="443" /></Set><Set name="idleTimeout"><Property name="jetty.ssl.idleTimeout" deprecated="ssl.timeout" default="30000"/></Set><Set name="acceptorPriorityDelta"><Property name="jetty.ssl.acceptorPriorityDelta" deprecated="ssl.acceptorPriorityDelta" default="0"/></Set><Set name="acceptQueueSize"><Property name="jetty.ssl.acceptQueueSize" deprecated="ssl.acceptQueueSize" default="0"/></Set><Get name="SelectorManager"><Set name="connectTimeout"><Property name="jetty.ssl.connectTimeout" default="15000"/></Set></Get></New></Arg></Call>
/usr/local/jetty/jetty-distribution-9.4.28.v20200408
目录下的 start.ini
文件,添加如下内容:etc/jetty-ssl.xmletc/jetty-ssl-context.xmletc/jetty-https.xml
java -jar start.jar
,即可使用 https://cloud.tencent.com
访问。https://cloud.tencent.com
访问若显示如下:
/usr/local/jetty/jetty-distribution-9.4.28.v20200408/demo-base/webapps
目录下的 ROOT 文件复制到 /usr/local/jetty/jetty-distribution-9.4.28.v20200408/webapps
目录下,重启 jetty,即可访问成功。
本页内容是否解决了您的问题?