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:UsersThinkpaTomcatapache-tomcat-8.5.33webappsggxs" path="/" debug="0"  reloadable="true"/>

4、修改C:WindowsSystem32driversetc下的hosts文件,加上下列代码;

  127.0.0.1  www.lingtong.com

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

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

原文地址:https://www.cnblogs.com/lt3232696/p/10844207.html