Skip to content

Instantly share code, notes, and snippets.

@lokesh-webonise
Last active December 20, 2015 03:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lokesh-webonise/6062130 to your computer and use it in GitHub Desktop.
Save lokesh-webonise/6062130 to your computer and use it in GitHub Desktop.
Intergrate apache tomcat server with Apache web server

##Interate Tomcat with apache

###Firstly switched to the sudo bash

$sudo bash

###Install Apache web server

#apt-get install apache2

###Then install Apache Tomcat server #####1. Downoad the latest Apache binary distribution from

wget http://tomcat.apache.org/

#####2. Extract tarball to /opt

tar -zxf apache-tomcat-*.*.tar.gz -C /opt

#####3. Run tomcat server

    cd /opt/apache-tomcat-*.*/bin
    ./startup.sh

#####4. To check Tomcat log

tail /opt/apache-tomcat-*.*/logs/catalina.out

###How to create virtual host in apache tomcat, follow below url

https://gist.github.com/lokesh-webonise/5821607

###Now, to integrate Tomcate with apache, we have to install JK module in apache #####To install jk module

#apt-get install libapache2-mod-jk

#####Restart apache server

#servive apache2 restart

#####Now create workers.properties file, know about workers http://tomcat.apache.org/connectors-doc/generic_howto/workers.html

vim /etc/apache2/workers.properties

worker.list=worker1

worker.worker1.port=8009  ##ajp service port no.
worker.worker1.host=abc.example.com   ##domain name
worker.worker1.type=ajp13    
:wq!

#####Edit the workers.properties file path in jk module

#vim /etc/apache2/mods-available/jk.conf
JkWorkersFile /etc/apache2/workers.properties
.
.
.
:wq!

#####Create virtual host in apache

vim /etc/apache2/sites-available/abc.example.com
<virtualhost :80>
    ServerName abc.example.com
    jkmount /* worker1
</virtualhost>

#####then enable Vhost

ln -s /etc/apache2/sites-available/abc.example.com /etc/apache2/sites-enable

####Restart apache server

#/etc/init.d/apache2 restart

#####open url http://abc.example.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment