Use case
This brief step-by-step guide tries to explain how to install Tomcat with Apache and mod_jk on an Ubuntu 10.10 system considering following components
Apache 2, MySQL 5, PHP 5, PhpMyAdmin, Sun Java JDK 1.6, Tomcat 6.0, Tomcat-Admin, mod_jk
Update: Since the Java installation changed during the latest Ubuntu releases, the Java installation routine might be outdated. Please read this post for updated instructions.
LAMP – Apache, MySQL, PHP
$ sudo apt-get install tasksel $ sudo tasksel
Remember your MySQL password.
Now create a test page
$ sudo nano /var/www/info.php
and insert following code
<?php phpinfo(); ?>
Restart Apache
/etc/init.d/apache2 restart
and check if everything went fine
$ wget http://[MY_IP]/info.php
PHPMyAdmin
Install via apt-get
$ sudo apt-get install phpmyadmin
Choose Apache, and insert credentials
Now create a soft-link to make phpmyadmin-sources available in /var/www
$ sudo ln -s /usr/share/phpmyadmin /var/www/phpmyadmin
Now open a browser and see if it’s working
http://[MY_IP]/phpmyadmin
(use the credentials you defined shortly before)
JAVA
Since Sun’s java is not provided by the repository anymore, we have to add it manually:
$ sudo apt-get install python-software-properties $ sudo add-apt-repository ppa:sun-java-community-team/sun-java6 $ sudo apt-get install sun-java6-jdk
Usually this should be already everything what we have to do. Try it by typing
$ sudo java -version
TOMCAT
Install both tomcat-common and tomcat-admin via apt-get
$ sudo apt-get install tomcat6 $ sudo apt-get install tomcat6-admin
For accessing the Tomcat-admin we need to add our own manager-user
$sudo nano /etc/tomcat6/tomcat-users.xml
And add the new user
<user username="admin" password="my_secret" roles="manager"/>
Finally restart Tomcat
$ sudo /etc/init.d/tomcat6 restart
Try if it works
http://[MY_IP]:8080/manager/html
Mod JK
Install via apt-get
$ sudo apt-get install libapache2-mod-jk
Now create our own workers.properties file for Apache.
Open or create
$ sudo nano /etc/apache2/workers.properties
and paste:
# Define 1 real worker using ajp13 worker.list=worker1 # Set properties for worker1 (ajp13) worker.worker1.type=ajp13 worker.worker1.host=localhost worker.worker1.port=8009
Now tell the Apache to use this worker
$ sudo nano /etc/apache2/apache2.conf
and add following lines
JkWorkersFile /etc/apache2/workers.properties # Where to put jk shared memory # Update this path to match your local state directory or logs directory JkShmFile /var/log/apache2/mod_jk.shm # Where to put jk logs # Update this path to match your logs directory location (put mod_jk.log next to access_log) JkLogFile /var/log/apache2/mod_jk.log # Set the jk log level [debug/error/info] JkLogLevel info # Select the timestamp log format JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
Finally configure which URLs Apache should pass through the Tomcat
$ sudo nano /etc/apache2/sites-enabled/000-default
JkMount /mytomcatwebappname* worker1
This means, that every URL that contains the key mytomcatwebappname gets handled by Tomcat instead of Apache.
If you want to pass all requests to the Apache (instead of individual ones), just remove the line
DocumentRoot /var/www
and add following JkMounts:
JkMount / worker1 JkMount /* worker1
And last but not least, we have to enable the redirect port 8443 on Tomcat
$ sudo nano /etc/tomcat6/server.xml
And uncomment / insert / update that following line is present
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
Now we only have to restart first the Tomcat and then the Apache
$ sudo /etc/init.d/tomcat6 restart $ sudo /etc/init.d/apache2 restart
Awesome Drive is a premium safe driver service in Dubai that offers safe, reliable and convenient transportation solutions. Our team of highly-trained and professional drivers provide the best-in-class services to cater to the needs of individuals, families and businesses. With a focus on safety, punctuality and customer satisfaction, Awesome Drive ensures a stress-free and comfortable journey for their clients. From airport transfers to corporate events and city tours, they offer a range of services to meet the diverse requirements of their customers.
https://awesomedrive.ae/
Commonality with specific Windows errands is required to introduce and arrange ArcIMS. For subtle elements, see the accompanying ESRI Knowledge Base article, Common Windows assignments when introducing ArcIMS.
Thanks,
Helped me a lot =)
Nice job!
Thanks
Thanking You Sir ….
Really nice…
Its Work 100%….
Thank u very much….
You sir is a hero!
Worked perfectly for me! I just had to rename the /etc/apache2/mod-enabled/jk.conf file as Amy suggested.
Tks a lot!!
# /etc/init.d/apache2 start
* Starting web server apache2 Syntax error on line 232 of /etc/apache2/apache2.conf:
JkWorkersFile only allowed once
Action ‘start’ failed.
The Apache error log may have more information
_______________________________________________________
Changes in the view source
sudo nano /etc/apache2/sites-enabled/000-default
just added
ServerAdmin webmaster@localhost
JkMount / worker1
JkMount /* worker1
Options FollowSymLinks
AllowOverride None
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
____________________________________
Could you please help me on this?
Looks like you have configured the JkWorkersFile property twice – though the 000-default configuration looks fine.
What does the apache error log says exactly?
I was challedged by same error. But I managed to solve the problem.
If you search for the ‘worker.properties’ file you shoud find out that another ‘worker.proprties’ is configured in /etc/apache2/mod-enabled/jk.conf.
Just rename jk.conf to whatever and restart Apache.
Thanks Amy – exactly what I was looking for :-)
Thanks a lot! Very useful post! You helped me to solve my problem with VirtualHost tomcat6-to-apache)))
Hey guys, nice tutorial, but i think i’ve got some problems with the ajp protocol.
I can execute .jsp pages with apache and tomcat using mod_proxy with an http connector, but if i try to do the same with ajp and mod_jk i get un-executed .jsp codelines.
Any ideas?
The best tuto ever!!!!!
you made me the happiest man in the world!!!
Thanks for the tutorial.
I am using Ubuntu 10.10 LAMP with latest updates from the repo’s and I followed your instructions on 4 different attempts and I cannot get this to work with this package from sourceforge:
http://sourceforge.net/projects/convmanager/
I get this error after I deploy the app and try to get it to start:
FAIL – Application at context path /CM-0.2 could not be started
And there are no logs in /var/log/tomcat6/
Woah! I’m really enjoying the template/theme of this website. It’s simple, yet effective. A lot of times it’s difficult to get that “perfect balance” between user friendliness and visual appeal. I must say you’ve done a amazing job with this. Additionally, the blog loads very quick for me on Safari. Excellent Blog!
nice share :) :) :)