• 域名直接访问项目|Tomcat http 自动跳转Https


    1.域名直接访问项目

     案例:tomcat下域名直接访问项目,或者说,修改tomcat默认欢迎页

     (1).修改server.xml

             添加: <Context path="" docBase="C:TOOLapache-tomcat-8.0.51webappshome" debug="0"/>  目标地址指到:你的项目根路径下C:TOOLapache-tomcat-8.0.51webappshome

     <Host name="localhost"  appBase="webapps"
                unpackWARs="true" autoDeploy="true">
    
        <Context path="" docBase="C:TOOLapache-tomcat-8.0.51webappshome" 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了  

    -----------------------------------------------------分割线-------------------------------------------------------------

     点击链接:先领劵,在支付,点我哦

  • 相关阅读:
    端口查看netstat -tunpl |grep 25
    解释一下查找出文件并删除find /var/log -type f -mtime +7 -ok rm {} ;
    2021.6.2
    2021.6.1
    2021.5.31
    2021.5.30(每周总结)
    2021.5.28
    2021.5.27
    2021.5.26
    2021.5.25
  • 原文地址:https://www.cnblogs.com/wookong/p/13053722.html
Copyright © 2020-2023  润新知