conf/server.xml
移除注释内容后,类似内容如下:
<Server> …… …… …… <Service name="Catalina"> <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /> <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /> <Engine name="Catalina" defaultHost="localhost"> <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/> <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false"> </Host> </Engine> </Service> </Server>
多个虚拟主机的配置,即增加 <service> 或 <host> 标签段。
一、端口方式:<Service>
在</Service>与</Server>之间增加
</Host> </Engine> </Service> <!-- 虚拟主机:端口方式 须修改三个地方: Service name / Connetor port / Host appBase
appBase可为相对路径,也可为绝对路径 --> <Service name="Catalina2"> <Connector port="6038" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="6444" /> <Connector port="6010" protocol="AJP/1.3" redirectPort="6444" /> <Engine name="Catalina" defaultHost="localhost"> <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/> <Host name="localhost" appBase="webapps2" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false"> </Host> </Engine> </Service> </Server>
http://localhost:8080/
http://locathost:6037/
二、域名方式:<Host>
在</Host>与</Engine>之间增加
</Host> <!--虚拟主机:域名方式,需修改 Host name/appBase --> <Host name="a.b.c" appBase="webapps2" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false"> </Host> </Engine> </Service> </Server>
http://locathost:8080/
http://a.b.c:8080/
Q 说:
欢迎转载,但请注明内容的来源或URL;
“[转]”篇章,必须保留原始来源且勿添加本blog指向。
欢迎转载,但请注明内容的来源或URL;
“[转]”篇章,必须保留原始来源且勿添加本blog指向。