- Install Tomcat in /opt/tomcat. (You can choose different path as well. You are independent after all)
- Create two directories beneath /opt/, say article-stack.com and thinkzarahatke.com, to keep 2 separate instances of Tomcat.
- Create required sub-directories in article-stack.com and thinkzarahatke.com.
- Copy all contents of conf directory from installed Tomcat distribution to newly created conf directory in step 3.
- Since both Tomcat instance must run from different ports, change port number in both server.xml (/opt/thinkzarahatke.com/conf/server.xml and /opt/article-stack.com/conf/server.xml). Keep port number different in both server.xml.
- Now, you must set the CATALINA_HOME environment variable to where you installed the Tomcat binary distribution (ie /opt/tomcat) and you must set the CATALINA_BASE environment variable to a different path where you are storing a JVM instance’s files (ie /opt/article-stack.com and /opt/thinkzarahatke.com)
- Create start.sh & stop.sh script to run particular Tomcat instance
- Put following contents inside start.sh
- Put following contents inside stop.sh
- Repeat all 3 steps for another instance. But change the value of CATALINA_BASE to “/opt/thinkzarahatke.com”
#!/bin/sh set CATALINA_BASE="/opt/article-stack.com " set CATALINA_HOME="/opt/tomcat" export CATALINA_BASE CATALINA_HOME service tomcat start # Standard way to start on Linux
#!/bin/sh set CATALINA_BASE="/opt/article-stack.com " set CATALINA_HOME="/opt/tomcat" export CATALINA_BASE CATALINA_HOME service tomcat stop # Standard way to stop on Linux
#cd thinkzarahatke.com #mkdir common logs temp server shared webapps work conf
#cp -a $CATALINA_HOME/conf conf/.
<Server port="8007" shutdown="SHUTDOWN"> : <!-- Define a non-SSL HTTP/1.1 Connector on port 8080 --> <Connector port="8081" maxHttpHeaderSize="8192" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" redirectPort="8443" acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true" />
#mkdir /opt/article-stack.com/bin #cd /opt/article-stack.com/bin