Entries tagged [apache]

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...