Skip to content

Instantly share code, notes, and snippets.

@wdfx100
Created March 29, 2013 00:44
Show Gist options
  • Save wdfx100/5267970 to your computer and use it in GitHub Desktop.
Save wdfx100/5267970 to your computer and use it in GitHub Desktop.
Tomcat设置虚拟目录,及修改本地主机
一、三种设置虚拟目录的方式
Tomcat设置 /conf/server.xml
• 修改端口号
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
1、配置虚拟目录
<Engine name="Catalina" defaultHost="localhost">
<Host name="localhost" autoDeploy="true">
<Context docBase="E:\\Workspaces\\test\\WebRoot" path="" reloadable="true" />
</Host>
</Engine>
2.虚拟目录
<Host name="localhost" autoDeploy="true" appBase="webapps" unpackWARs="true" xmlvalidation="false" xmlNamespaceAware="false">
<Context docBase="E:\\Workspaces\\test\\WebRoot" path="/test" reloadable="true" />
</Host>
3.在conf/Catalina/ localhost新建xxx.xml文件,内容如下:
同样可以实现虚拟目录
<Context docBase="E:\\Workspaces\\test\\WebRoot" path="" reloadable="true" />
二、修改主机网址
C:\Windows\System32\drivers\etc的hosts文件
127.0.0.1 www.wdfx100.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment