In the Tomcat Virtual Host Manager there is an option to add a virtual host with options for:
Name
Aliases
App base
AutoDeploy
DeployOnStartup
DeployXML
UnpackWARs
Manager App
However there doesn't appear to be an option to set the docBase for a virtual host as I have done previously when adding them manually in the XML configuration file:
<Host name="[my_domain_name]" appBase="webapps">
<Context path="" docBase="[path_to_my_site]" />
</Host>
Is there any way to add this via the manager, or if not, what would the default docBase end up being?
Thanks.
N.B. I'm using Tomcat 7
Best Answer
There is no docBase attribute for an Host. There is one for the context as you can see in your snippet. Per the documentation :
(see Tomcat 7.0.x documentation)
To declare a personnalised
docbase
, you will have to set it in allcontext
declaration for the host. (As a side note, it is strongly discouraged to declarecontext
in web.xml, you should add an xml file in the folderconf/<engine-name>/<host>
)As an alternative, seeing as you have an
appBase
attribute on your host, you can just deploy your war in that path and the doc base will then be the path to your war (expended or not following the other attributes).For exemple, let's say we have an host in server.xml like :
andan application i want to deploy to
exemple.org/appli
. Either I add a file appli.xml inconf/Catalina/exemple.org/
which content is :Or I put the war (named
appli.war
) inwebapps/exemple.org/
Again see Tomcat Documentation for all the details.