How do I set up virtual hosting on Tomcat in standalone mode?

Serge Knystautas

In Tomcat 3.2b6, it is very easy to setup virtual hosts in standalone mode. First, be sure to set the correct port for the HTTP listener (the default is 8080, and you'll probably want to change it to 80). Second, wrap your servlet context definitions (in your server.xml) with a <host> tag, specifying the domain name to work on. Here is an exerpt from a server.xml that is configured for virtual hosting:

<Host name="server1.domain.com">
<Context path="" docBase="/var/www/server1" reloadable="true" debug="0" />
<Host name="server2.domain.com">
<Context path="" docBase="/var/www/server1" reloadable="true" debug="0" />

0 Comments  (click to add your comment)
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



About | Sitemap | Contact
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.