Jetty服務(wù)器配置SSL證書的圖文教程

SSL證書安裝系列之“Jetty服務(wù)器部署SSL證書”的圖文教程步驟。本站一直持續(xù)更新不同服務(wù)器下SSL證書安裝教程,供大家參考。

網(wǎng)站建設(shè)哪家好,找成都創(chuàng)新互聯(lián)公司!專注于網(wǎng)頁設(shè)計、網(wǎng)站建設(shè)、微信開發(fā)、小程序制作、集團企業(yè)網(wǎng)站建設(shè)等服務(wù)項目。為回饋新老客戶創(chuàng)新互聯(lián)還提供了新絳免費建站歡迎大家使用!

1、Jetty服務(wù)器版本確認。建議使用Jetty 9.2.22及以上版本。

2、下載tomcat格式的SSL證書。非系統(tǒng)生成的CSR需要生成pfx證書密匙對文件,轉(zhuǎn)換命令如下。

openssl pkcs12 -export -out 214362464370691.pfx -inkey 214362464370691.key -in 214362464370691.pem

3、轉(zhuǎn)換pfx的證書密匙對文件為jks格式,轉(zhuǎn)換命令如下:

keytool -importkeystore -srckeystore 密匙對文件.pfx -destkeystore 證書名稱.jks -srcstoretype PKCS12 -deststoretype JKS

回車后輸入兩次要設(shè)置的jks格式證書密碼,然后輸入一次pfx證書密碼。三次密碼必須輸入pfx-password.txt記錄的密碼。jks密碼與pfx證書密碼相同,否則可能會導(dǎo)致Jetty服務(wù)器啟動失敗。

注:Windows環(huán)境注意在%JAVA_HOME%/jdk/bin目錄中執(zhí)行。

4、配置Jetty的SSL。

1)確保Jetty的http頁面可正常訪問。

2)拷貝證書。進入Jetty服務(wù)器目錄下的etc,新建存放jks格式證書的目錄,并復(fù)制jks格式證書至當前目錄。

# pwd

/opt/jetty9222/etc

# mkdir cert

# cd cert/

# cp ../../../keys/jetty.jks .

# ls

jetty.jks

3)編輯Jetty服務(wù)器目錄中的etc中的jetty-ssl.xml文件,設(shè)置證書相關(guān)參數(shù)(密碼設(shè)置均為pfx-password.txt所記錄的密碼)。

<?xml version=”1.0″?>

<!DOCTYPE Configure PUBLIC “-//Jetty//Configure//EN” “http://www.eclipse.org/jetty/configure_9_0.dtd”>

<!– ============================================================= –>

<!– Configure a TLS (SSL) Context Factory –>

<!– This configuration must be used in conjunction with jetty.xml –>

<!– and either jetty-https.xml or jetty-spdy.xml (but not both) –>

<!– ============================================================= –>

<Configure id=”sslContextFactory” class=”org.eclipse.jetty.util.ssl.SslContextFactory”>

<Set name=”KeyStorePath”><Property name=”jetty.base” default=”.” />/<Property name=”jetty.keystore” default=”etc/cert/jetty.jks”/></Set>

<Set name=”KeyStorePassword”><Property name=”jetty.keystore.password” default=”214362464370691″/></Set>

<?xml version=”1.0″?>

<!DOCTYPE Configure PUBLIC “-//Jetty//Configure//EN” “http://www.eclipse.org/jetty/configure_9_0.dtd”>

<!– ============================================================= –>

<!– Configure a TLS (SSL) Context Factory –>

<!– This configuration must be used in conjunction with jetty.xml –>

<!– and either jetty-https.xml or jetty-spdy.xml (but not both) –>

<!– ============================================================= –>

<Configure id=”sslContextFactory” class=”org.eclipse.jetty.util.ssl.SslContextFactory”>

<Set name=”KeyStorePath”><Property name=”jetty.base” default=”.” />/<Property name=”jetty.keystore” default=”etc/cert/jetty.jks”/></Set>

<Set name=”KeyStorePassword”><Property name=”jetty.keystore.password” default=”214362464370691″/></Set>

<Set name=”KeyManagerPassword”><Property name=”jetty.keymanager.password” default=”214362464370691″/></Set>

<Set name=”TrustStorePath”><Property name=”jetty.base” default=”.” />/<Property name=”jetty.truststore” default=”etc/cert/jetty.jks”/></Set>

<Set name=”TrustStorePassword”><Property name=”jetty.truststore.password” default=”214362464370691″/></Set>

<Set name=”EndpointIdentificationAlgorithm”></Set>

<Set name=”NeedClientAuth”><Property name=”jetty.ssl.needClientAuth” default=”false”/></Set>

<Set name=”WantClientAuth”><Property name=”jetty.ssl.wantClientAuth” default=”false”/></Set>

<Set name=”ExcludeCipherSuites”>

<Array type=”String”>

<Item>SSL_RSA_WITH_DES_CBC_SHA</Item>

<Item>SSL_DHE_RSA_WITH_DES_CBC_SHA</Item>

<Item>SSL_DHE_DSS_WITH_DES_CBC_SHA</Item>

<Item>SSL_RSA_EXPORT_WITH_RC4_40_MD5</Item>

<Item>SSL_RSA_EXPORT_WITH_DES40_CBC_SHA</Item>

<Item>SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA</Item>

<Item>SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA</Item>

</Array>

</Set>

<!– =========================================================== –>

<!– Create a TLS specific HttpConfiguration based on the –>

<!– common HttpConfiguration defined in jetty.xml –>

<!– Add a SecureRequestCustomizer to extract certificate and –>

<!– session information –>

<!– =========================================================== –>

<New id=”sslHttpConfig” class=”org.eclipse.jetty.server.HttpConfiguration”>

<Arg><Ref refid=”httpConfig”/></Arg>

<Call name=”addCustomizer”>

<Arg><New class=”org.eclipse.jetty.server.SecureRequestCustomizer”/></Arg>

</Call>

</New>

</Configure>

4)編輯Jetty服務(wù)器目錄中的etc中的jetty-https.xml文件,配置https所使用的443端口。

<?xml version=”1.0″?>

<!DOCTYPE Configure PUBLIC “-//Jetty//Configure//EN” “http://www.eclipse.org/jetty/configure_9_0.dtd”>

<!– ============================================================= –>

<!– Configure a HTTPS connector. –>

<!– This configuration must be used in conjunction with jetty.xml –>

<!– and jetty-ssl.xml. –>

<!– ============================================================= –>

<Configure id=”Server” class=”org.eclipse.jetty.server.Server”>

<!– =========================================================== –>

<!– Add a HTTPS Connector. –>

<!– Configure an o.e.j.server.ServerConnector with connection –>

<!– factories for TLS (aka SSL) and HTTP to provide HTTPS. –>

<!– All accepted TLS connections are wired to a HTTP connection.–>

<!– –>

<!– Consult the javadoc of o.e.j.server.ServerConnector, –>

<!– o.e.j.server.SslConnectionFactory and –>

<!– o.e.j.server.HttpConnectionFactory for all configuration –>

<!– that may be set here. –>

<!– =========================================================== –>

<Call id=”httpsConnector” name=”addConnector”>

<Arg>

<New class=”org.eclipse.jetty.server.ServerConnector”>

<Arg name=”server”><Ref refid=”Server” /></Arg>

<Arg name=”acceptors” type=”int”><Property name=”ssl.acceptors” default=”-1″/></Arg>

<Arg name=”selectors” type=”int”><Property name=”ssl.selectors” default=”-1″/></Arg>

<Arg name=”factories”>

<Array type=”org.eclipse.jetty.server.ConnectionFactory”>

<Item>

<New class=”org.eclipse.jetty.server.SslConnectionFactory”>

<Arg name=”next”>http/1.1</Arg>

<Arg name=”sslContextFactory”><Ref refid=”sslContextFactory”/></Arg>

</New>

</Item>

<Item>

<New class=”org.eclipse.jetty.server.HttpConnectionFactory”>

<Arg name=”config”><Ref refid=”sslHttpConfig”/></Arg>

</New>

</Item>

</Array>

</Arg>

<Set name=”host”><Property name=”jetty.host” /></Set>

<Set name=”port”><Property name=”https.port” default=”443″ /></Set>

<Set name=”idleTimeout”><Property name=”https.timeout” default=”30000″/></Set>

<Set name=”soLingerTime”><Property name=”https.soLingerTime” default=”-1″/></Set>

<Set name=”acceptorPriorityDelta”><Property name=”ssl.acceptorPriorityDelta” default=”0″/></Set>

<Set name=”selectorPriorityDelta”><Property name=”ssl.selectorPriorityDelta” default=”0″/></Set>

<Set name=”acceptQueueSize”><Property name=”https.acceptQueueSize” default=”0″/></Set>

</New>

</Arg>

</Call>

</Configure>

5)編輯Jetty服務(wù)器目錄中的start.ini文件,按需求更改端口號,并設(shè)置啟動加載

jetty-https.xml,jetty-ssl.xml。

jetty.port=80

jetty.dump.stop=

etc/jetty-ssl.xml

etc/jetty-https.xml

6)重啟Jetty,訪問網(wǎng)站驗證https訪問是否正常,成功顯示綠色小鎖表示SSL證書安裝成功。

分享題目:Jetty服務(wù)器配置SSL證書的圖文教程
當前網(wǎng)址:http://www.muchs.cn/article36/doepg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供用戶體驗、服務(wù)器托管網(wǎng)站改版、App設(shè)計、網(wǎng)站收錄、電子商務(wù)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

綿陽服務(wù)器托管