Tomcat配置https并訪(fǎng)問(wèn)http自動(dòng)跳轉(zhuǎn)至https
Tomcat配置https、訪(fǎng)問(wèn)http自動(dòng)跳轉(zhuǎn)至https
1、配置Tomcat,打開(kāi)$CATALINA_HOME/conf/server.xml,修改如下
<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />
修改參數(shù)==>
<Connector port="80" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="443" />
<!-- <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true" maxThreads="150" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" /> -->
去掉注釋且修改參數(shù)==>
<Connector port="443" protocol="org.apache.coyote.http11.Http11Protocol" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS"
keystoreFile="d:/dev/tomcat.keystore"
keystorePass="123456" />
<!-- <Connector port="8009" enableLookups="false" protocol="AJP/1.3" redirectPort="8443" /> -->
修改參數(shù)==>
<Connector port="8009" enableLookups="false" protocol="AJP/1.3" redirectPort="443" />
二、局部https安全連接配置,打開(kāi)web項(xiàng)目\WEB-INF\web.xml文件,在該文件</welcome-file-list>后面加上這樣一段:
<!-- 局部https安全連接配置 -->
<security-constraint>
<display-name>Auth</display-name>
<web-resource-collection>
<web-resource-name>Protected Area</web-resource-name>
<!--
<url-pattern>/index/json/login</url-pattern>
<url-pattern>/admin/json/admin/companyLogin</url-pattern>
<url-pattern>/admin/companyLogin</url-pattern>
<url-pattern>/admin/agentLogin</url-pattern>
-->
<url-pattern>/user/*</url-pattern>
<url-pattern>/main/index</url-pattern>
</web-resource-collection>
<user-data-constraint>
<description>SSL required</description>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
上述配置完成后,重啟TOMCAT后即可以使用SSL。IE地址欄中可以直接輸入地址不必輸入“http://” 或者 “https://” ;也可以輸入 “http:// ” 會(huì)跳轉(zhuǎn)成為 “https://” 來(lái)登錄
感謝閱讀,希望能幫助到大家,謝謝大家對(duì)本站的支持!
相關(guān)文章
AJAX自學(xué)練習(xí) 無(wú)刷新從數(shù)據(jù)庫(kù)后臺(tái)取數(shù)據(jù)顯示
AJAX自學(xué)練習(xí) 無(wú)刷新從數(shù)據(jù)庫(kù)后臺(tái)獲取數(shù)據(jù)并顯示的代碼,大家可以參考下。2009-09-09
JSP上傳excel及excel插入至數(shù)據(jù)庫(kù)的方法
這篇文章主要介紹了JSP上傳excel及excel插入至數(shù)據(jù)庫(kù)的方法,涉及JSP文件上傳及針對(duì)excel的讀取、寫(xiě)入數(shù)據(jù)庫(kù)等操作技巧,需要的朋友可以參考下2015-10-10
兩個(gè)JSP頁(yè)面父頁(yè)面獲取子頁(yè)面內(nèi)容的兩種方法
兩個(gè)JSP頁(yè)面,父頁(yè)面需要子頁(yè)面的內(nèi)容,但子頁(yè)面是隱藏的,本文介紹兩種解決方案,比較實(shí)用2014-10-10
JSP 開(kāi)發(fā)之Spring Boot 動(dòng)態(tài)創(chuàng)建Bean
這篇文章主要介紹了JSP 開(kāi)發(fā)之Spring Boot 動(dòng)態(tài)創(chuàng)建Bean的相關(guān)資料,需要的朋友可以參考下2017-07-07
簡(jiǎn)單實(shí)現(xiàn)jsp分頁(yè)
這篇文章主要為大家詳細(xì)介紹了如何簡(jiǎn)單實(shí)現(xiàn)jsp分頁(yè),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2016-12-12
Spring mvc 分步式session的實(shí)例詳解
這篇文章主要介紹了Spring mvc 分步式session的實(shí)例詳解的相關(guān)資料,這里舉例說(shuō)明該如何使用spring mvc 分不式的實(shí)例,希望能幫助到大家,需要的朋友可以參考下2017-08-08
Java Web實(shí)現(xiàn)的基本MVC實(shí)例分析
這篇文章主要介紹了Java Web實(shí)現(xiàn)的基本MVC,以完整實(shí)例形式較為詳細(xì)的分析了JSP實(shí)現(xiàn)MVC架構(gòu)的具體步驟與相關(guān)技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下2015-09-09

