coucou78 coucou78 wrote:

3 - ....

This is for illustration only, but it's quick and will give your more ideas :

Have a look at your original server.xml.
In it, there is a section starting with something like :
<Host name="localhost" appBase="webapps"
       unpackWARs="true" autoDeploy="true"
       xmlValidation="false" xmlNamespaceAware="false">
and ending with a </Host> tag further down.

Duplicate this entire section, then in the duplicated one, change the Host tag as follows :
<Host name="mysecondhost.company.com" appBase="webapps-test"
       unpackWARs="true" autoDeploy="true"
       xmlValidation="false" xmlNamespaceAware="false">

Next, at the same level where your "webapps" directory is, create another one named "webapps-test".

Next, copy the contents of your "webapps" directory, into the "webapps-test" directory (everything, and make sure that you also duplicate the owner, permissions, etc.

Next, arrange to define "mysecondhost.company.com" in your DNS system, as an "alias" to the original name of your host. As a temporary shortcut for testing, if as a client you are using a Windows workstation, edit your windows/system32/drivers/etc/hosts file, and add a line like
111.222.333.444 mysecondhost.company.com
(where 111.222.333.444 should be replaced by the IP address of your tomcat host)

Restart Tomcat.

In your browser, try "http://mysecondhost.company.com"; (followed by whatever your application requires). The response you get, is being served by the "webapps-test" copies of the applications. If you use your original URL, the response is being served by the original copies of the applications, under "webapps".


What I just outlined above, is called "Virtual Hosts".
You need only one instance of Tomcat, only one port, and yet you have two entirely separate "areas" with applications.

Now you can start playing around with the appBase,autoDeploy, and unpackWars attributes of your Host tags, as the other contributors have indicated, to "share" maybe a single webapps directory. But I would recommend that you try the brute method above first, to get familiar with the implications.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to