Tuesday, May 15, 2012

Installing Tomcat 7 and Apache2 with mod_jk on Ubuntu 12.04

This is a compact note on how to install Tomcat and Apache2, and then configure to connect the Apache Web Server to Tomcat using mod_jk on Ubuntu 12.04 (the basics are the same, so should work on all OS with minor modifications).

1. Installing Apache, Tomcat

sudo apt-get install apache2

Test the installation from the browser using http://localhost/

sudo apt-get install tomcat7
sudo apt-get install tomcat7-admin

Create a test application for tomcat.
cd /var/lib/tomcat7/webapps
sudo mkdir tomcat-demo
sudo mkdir tomcat-demo/helloworld
sudo vim tomcat-demo/helloworld/index.jsp

and paste the code
  <TITLE>Hello World</TITLE>
  <H1>Hello World</H1>
  Today is: <%= new java.util.Date().toString() %>
Test the installation from the browser using


2. Installing and configuring mod_jk

sudo apt-get install libapache2-mod-jk

First lets enable the redirect port 8443 on Tomcat

sudo vim /etc/tomcat7/server.xml

and uncomment the following line
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
Now we will create our workers.properties file for Apache.

sudo vim /etc/apache2/workers.properties

paste the text
# Define 1 real worker using ajp13 
# Set properties for worker (ajp13) 
Now to ask Apache to use this worker

sudo vim /etc/apache2/mods-available/jk.conf

change the JkWorkersFile property to

Finally to configure the URL Apache should pass through the Tomcat

sudo vim /etc/apache2/sites-enabled/000-default

and add the following line in your configurtation
<VirtualHost *:80>
JkMount /tomcat-demo* worker1
</VirtualHost *:80>
Now, restart the servers

sudo /etc/init.d/tomcat7 restart
sudo /etc/init.d/apache2 restart

and test with
it should work similarly to

Thursday, May 10, 2012

Wordpress 3.3.2 Featured Image Missing!!!

Installed my Wordpress 3.3.2 and couldn't find the whole "Featured Image" for a post functionality missing. Googled a lot and here is what I found.

Add to the theme functions.php
and hey, it is working.