Description: Here I have explained How to configure Virtual Host in Tomcat
Procedure:
3. Restart tomcat service
Procedure:
- To create Virtual hosts first you need to navigate to installation directory and edit config/server.xml or conf/server.xml in editor. Then create virtual host for your applications
- The first application with domain name application1.com and /opt/tomcat/webapps/app1 document root
- Second application with domain name application2.com and /opt/tomcat/webapps/app2 document root.
<Host name="application1.com" appBase="webapps" unpackWARs="true" autoDeploy="true">
<Alias>application1.com</Alias>
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="example_access_log" suffix=".txt"
pattern="%h %l %u %t %r %s %b" />
<Context path="" docBase=" /opt/tomcat/webapps/app1"
debug="0" reloadable="true"/>
</Host>
<Host name="application2.com" appBase="webapps" unpackWARs="true" autoDeploy="true">
<Alias>application2.com</Alias>
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="example_access_log" suffix=".txt"
pattern="%h %l %u %t %r %s %b" />
<Context path="" docBase="/opt/tomcat/webapps/app2 "
debug="0" reloadable="true"/>
</Host>
3. Restart tomcat service
No comments:
Post a Comment