Entries tagged [tomcat]

PageSpeed with HTTPS, Apache and Tomcat

Feb 21, 2016


PageSpeed is a tool by Google which rewrites/optimizes resources served by your web server so that your site loads faster. I think it was designed to work with sites that largely serve static content. Most PHP based sites are like that. For example, Wordpress installations can directly reside in the DocumentRoot of Apache. That makes it straightforward to configure PageSpeed. But if you are using a Java web application fronted by Apache, the PageSpeed documentation doesn't help you much.

PageSpeed configuration for dynamic content

If your web application serves content using a URL which does not map to a physical location in your DocumentRoot, PageSpeed will not be able to find it. For example, this blog runs on Apache Roller which serves static files using a logical path and not a physical path. If relative to your web application's root, the CSS files are present in this phsyical location:

roller/themes/alaru/css/

And the CSS files are served with this logical URL:

https://satishchilukuri.com/blog/resource/css/

PageSpeed will try to look for this physical location relative to DocumentRoot:

blog/resource/css

Read more...

Using Apache HTTP Server in front of Tomcat 8

Feb 04, 2015


Previously, I wrote about installing Java 8 and Tomcat 8. In this post, we’ll see how to use an Apache HTTP server in front of Tomcat 8. Note that the configuration described in this post is what worked for me. The official documentation (here and here) is heavy on the various configuration options that are available, but doesn’t help much if you are looking for a simple example of how to configure Tomcat with Apache HTTP server, and then tweak that simple configuration as you need. So depending on your goal, the information in this post may not be sufficient. With that caveat, here’s how I got things working:

Install and configure the Tomcat-Apache connector

(The version of Apache HTTP server that I’m using is 2.2, from Debian Wheezy repositories).

Install the Apache-Tomcat connector module:

sudo apt-get install libapache2-mod-jk

That should also enable the jk module in Apache. But just to be sure, enable it explicitly:

sudo a2enmod jk

The Apache-Tomcat connecter uses worker processes to handle requests forwarded by the Apache HTTP server. The configuration of thes processes is in /etc/libapache2-mod-jk/workers.properties. There, update the paths to tomcat_home and java_home. as I described in my previous post, if you are using separate Tomcat directories - one for Tomcat binaries and one for the config files and webapps, then tomcat_home should point to directory having the webapps.

Read more...

Installing Java 8 and Tomcat 8 on Debian Wheezy

Feb 01, 2015


Installing Java 8

By default, Debian repositories only have Open JDK and on Wheezy, the Open JDK version is the equivalent of Java 7. To get the latest Java 8, we need to install it manually. First download the Java 8 server JRE which comes with JVM monitoring tools. Or you could just download the Java 8 JDK which includes those monitoring tools and more. I prefer to install only the bare minimum setup that is necessary.

When manually installing software on Linux, it is recommended that it go into /opt directory. So unpack the JRE or JDK into /opt.

Create a symbolic link "java8" pointing to the JRE/JDK directory. This will make it easier when installing updates to the JRE/JDK. All Java dependent applications will refer to the symbolic link and when you do update the JRE/JDK, you don’t need to update the path to Java for all those applications. You just need to update the symbolic link.

cd /opt
sudo ln -s jdk1.8.0_25 java8

Add the Java bin directory to your PATH so that the Java commands are available to you. Edit your .profile file

vi ~/.profile

Read more...