1.域名直接訪問項目
案例:tomcat下域名直接訪問項目,或者說,修改tomcat默認歡迎頁
(1).修改server.xml
添加: <Context path="" docBase="C:\TOOL\apache-tomcat-8.0.51\webapps\home\" debug="0"/> 目標地址指到:你的項目根路徑下C:\TOOL\apache-tomcat-8.0.51\webapps\home\
<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true"> <Context path="" docBase="C:\TOOL\apache-tomcat-8.0.51\webapps\home\" debug="0"/> </Host>
(2).修改web.xml
你的初始頁面是什么,就改成什么,我的還是index.html,所以保持不變,你的要是login.html,添加一行
<welcome-file>login.html</welcome-file>
<welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> <welcome-file>index.jsp</welcome-file> </welcome-file-list>
重啟,就OK
2.http 自動跳轉https
主要修改兩方面:
(1).修改server.xml
所有跳轉,全部轉成443
(2).修改web.xml
<security-constraint> <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>
重啟就OK了
-----------------------------------------------------分割線-------------------------------------------------------------
點擊鏈接:先領劵,在支付,點我哦