Links

   Quran Explorer - Interactive Audio Recitations & Translations
Showing posts with label Server. Show all posts
Showing posts with label Server. Show all posts

Wednesday, September 1, 2010

Tomcat Virtual Hosts

Assumptions

1. One development host with two host names, devhost and prodhost each for development and production (configure dns accordingly or client's host file). Host name can be any valid hostnames including development.com, intranet.cit.go.ke, amongh others

2. One instance of Tomcat running,

so $CATALINA_HOME refers to wherever it's installed, perhaps /opt/tomcat.

3. Unix-style path separators and commands; if you're on Windows modify accordingly.

A. Configure Engine

File:server.xml at $CATALINA_HOME/conf

At the simplest, edit the Engine portion of your server.xml file to look like this:










B. Configure Webapps Directories


Create directories for each of the virtual hosts:

mkdir $CATALINA_HOME/devapps
mkdir $CATALINA_HOME/prodapps




Ah ha

I also normaly copy the host-manager/ and manager/ directories to corresponding webapps folder for each virtual host.
I dont know why but i just find myself doing it everytime i create virtualhosts (it may have something to do with manager.xml file in host-manager folder)

Fixing Tomcat PermGem Space Error

Tomcat PermGem Space error:

How to fix it ?

1) Find where is Cataline.sh located. We need to make some changes in “catalina.sh” file.
P.S Cataline.sh is located at /tomcat folder/bin/catalina.sh

2) Assign following line to JAVA_OPTS variable and add it into catalina.sh file.
JAVA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8
-server -Xms1536m -Xmx1536m
-XX:NewSize=256m -XX:MaxNewSize=256m -XX:PermSize=256m
-XX:MaxPermSize=256m -XX:+DisableExplicitGC"

Java Opts

-Xms
initial java heap size
-Xmx
maximum java heap size
-Xmn
the size of the heap for the young generation

-server starts Tomcat with the Server JVM