Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a website set up in a unix server.

I work in a team with two more developers who also work on the website.

The requirement is running two or more versions of the same site from two different directories in the same unix server.This is because two developers will be working on the same feature on the same files and having differnt versions of the same site will prevent each other from modifying the other developrs files.

Now I have copied the entire website webapps contents into another directory in the same server.

I have tomcat which was previously installed which points to the original webapps directory.

Now what do I need to do in order to host the new site which I have copied into a new directory.

What are the viable options here?

share|improve this question

I suggest opening bin/ in a text editor and start reading downward from this point:

# -----------------------------------------------------------------------------
# Control Script for the CATALINA Server
# Environment Variable Prerequisites
#   Do not set the variables in this script. Instead put them into a script
# in CATALINA_BASE/bin to keep your customizations separate.

bin/ does not exist by default, but it's a real gem: any variables or scriptlets that you place in such a file get sourced by bin/, which in turn gets invoked whenever bin/ and bin/ get invoked.

  • Continue to read downward from that point and note the various variables and what they do. Some of them may be familiar to you already, like JAVA_HOME. Others might not be, like CATALINA_OPTS, which should be preferred over JAVA_OPTS where possible.
  • Examine bin/ and bin/ carefully, looking for customizations: none of the variables explained in the bin/ documentation should be defined. Administrators and developers who don't know of bin/ have a tendency to modify the startup and shutdown scripts directly, which is a bad practice. Move these customizations to bin/ so that you can keep better track of the differences between your two Tomcat containers.
  • Use JAVA_HOME to specify the path to the different installations of Java. Tomcat will execute $JAVA_HOME/bin/java, not the version of java that happens to be in your PATH variable. (unless JRE_HOME exists, the documentation I've directed you to read explains the difference) If each Tomcat needs to use a different version of Java, then they should have different JAVA_HOME paths. If they should use the same version of Java, then the variable should be the same for both.
  • Adjust conf/server.xml and change the ports that Tomcat is listening on. All instances of the word port that are not inside of a comment block (<!-- -->) must be adjusted or there will be port conflicts.
  • If you have a requirement that both of these Tomcats must be behind a single port, you will either need a load balancer in front of them, or a webserver that proxies the traffic. The webserver can run on the same machine, you would proxy to localhost ( in such case. Based on the requested URI, have the load balancer or web server route the traffic to the appropriate Tomcat.
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.