Tomcat6 to apache2 configuration in ubuntu

22 Aug

Step 1:

Install libapache2-mod-jk in your machine

sudo apt-get install libapache2-mod-jk

sudo service apache2 restart

a2enmod jk

Step 2:

copy your file and past in


Example: file content below

# Define worker ‘example’

# Set properties for worker ‘example’ (ajp13)


your need to change your application-name in working property.

Step 3:

create jk.load



jk.load file content

LoadModule jk_module /usr/lib/apache2/modules/
JkWorkersFile   /etc/apache2/
JkLogFile       /var/log/apache2/mod_jk.log
JkLogLevel      info
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories -ForwardLocalAddress
JkRequestLogFormat “%w %V %T”
JkMount /xContext/* ajp

change in content:

/etc/apache2/ —> you created above.

Step 4:

create filename.conf in



filename.conf content

<VirtualHost *:80>
ServerName http://localhost
DocumentRoot “/home/user-name/apache-tomcat-6.0.32/webapps/ROOT”
<Directory “/home/user-name/apache-tomcat-6.0.32/webapps/ROOT”>
# Options Indexes FollowSymLinks MultiViews
Options None
AllowOverride None
Order allow,deny
allow from all

# Send ROOT app. to worker named app1
JkMount  /* application-name
JkUnMount  /images/* application-name


changes in content :

ServerName http://localhost   ——–>host name that you have mentioned
  DocumentRoot “/home/ideas2it/apache-tomcat-6.0.32/webapps/ROOT”  ——–> your apache path ROOT
<Directory “/home/ideas2it/apache-tomcat-6.0.32/webapps/ROOT”>  ———> your apache path ROOT

JkMount  /* application-name  ——> your application name same like
JkUnMount  /images/* application-name –>your application name same like

Step 5:

cd /etc/apache2/mods-enabled

ln -s /etc/apache2/sites-available/filename.conf .

sudo service apache2 restart

Setp 6:

Just confirm default file in


If it is not there please create file default


Default file content

<VirtualHost *:80>

ServerAdmin webmaster@localhost

DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory “/usr/lib/cgi-bin”>
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all

ErrorLog ${APACHE_LOG_DIR}/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog ${APACHE_LOG_DIR}/access.log combined

Alias /doc/ “/usr/share/doc/”
<Directory “/usr/share/doc/”>
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from ::1/128


Restart apache2.

Go and type http://localhost/ in your browser.

Your application will run perfectly.

1 Comment

Posted by on August 22, 2011 in Apache, Ubuntu


One response to “Tomcat6 to apache2 configuration in ubuntu

  1. Loganathan N

    August 3, 2012 at 2:45 pm

    its worked for me ..nice
    thanks 🙂

    while starting server 1 error occur:
    Syntax error on line 6 of /etc/apache2/mods-enabled/jk.load:
    JkRequestLogFormat takes one argument, The mod_jk module request log format string

    After Commenting this line #JkRequestLogFormat “%w %V %T” in jk.load it’s worked nice 🙂


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: