Tomcat虚拟URL路径访问项目

原地址:

    http://localhost:8080/ggxs/index.jsp

虚拟后:

    http://www.lingtong.com/index.jsp

 

 

1、端口号port="8080" 修改为 port="80";

  <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />

 

2、name属性修改成想要虚拟的路径,这里原“localhost” 修改 “www.lingtong.com”;

  <Host name="www.lingtong.com" appBase="webapps" unpackWARs="true" autoDeploy="true">

 

3、在<Host>XXXX</Host>这间在入下列代码,属性名“docBase”地址指向部署的项目,path值即将 URL中index.jsp前虚拟成的路径;

  <Context docBase="F:\Users\Thinkpa\Tomcat\apache-tomcat-8.5.33\webapps\ggxs" path="/" debug="0"  reloadable="true"/>

 

4、修改C:\Windows\System32\drivers\etc下的hosts文件,加上下列代码;

  127.0.0.1  www.lingtong.com

 

按上述4步即可达到虚拟后的URL效果;

 

                                                    ————————只为延续被帮助过的感动。

 

posted on 2019-05-10 14:21  0o好好先生o0  阅读(720)  评论(0编辑  收藏  举报

导航