从一开始,您在 conf / server.xml中 就有一个“主机”记录,用于
localhost
<Host name="localhost" appbase="webapps" unpackWARs="true" autoDeploy="true"> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log." suffix=".txt" pattern="%h %l %u %t "%r" %s %b" /></Host>
现在,您可以添加另一个“主机”记录,例如
<Host name="anotherclient.com" appbase="anotherclient" unpackWARs="true" autoDeploy="true"> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"prefix="anotherclient_access_log." suffix=".txt"pattern="%h %l %u %t "%r" %s %b" /> </Host>
name="anotherclient.com"新客户端的域在哪里,
appbase="anotherclient"其Web应用程序的根目录名称(在其中部署war);它是相对于tomcat主目录的。
重启tomcat后,更改将被接受。
转到其他任何域(未在中列出
server.xml)但指向服务器IP地址的请求将传递到默认应用程序,该请求在
Engine元素中指定
<Engine name="Catalina" defaultHost="localhost">



