Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to configure Apache2 + Tomcat using the mod_jk on an Ubuntu 10.04. I installed everything and configured, but it always returns the source code of my JSP files. I've read around that the most possible problem is that Httpd isn't redirecting the requests to Tomcat as it should. So, tried to fix it using many tutorials and explanations, none worked for me.

The page is this one:

The httpd.conf:

Include /etc/apache2/mods-available/jk.conf

The /etc/apache2/mods-available/jk.conf:

JkWorkersFile   /etc/libapache2-mod-jk/
JkLogFile       /var/log/apache2/mod_jk.log
JkLogLevel      info
JkMount /*.jsp geradorboletos
JkMount /* geradorboletos

The /etc/libapache2-mod-jk/





And the /etc/apache2/sites-available/geradorboletos:

<VirtualHost *:80>
        ServerAdmin webmaster@localhost

        DocumentRoot /var/lib/tomcat6/webapps/geradorboletos/
        <Directory />
                Options FollowSymLinks
                AllowOverride None

        <Directory /var/lib/tomcat6/webapps/geradorboletos/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all

        ErrorLog /var/log/apache2/geradorboletos-error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog /var/log/apache2/geradorboletos-access.log combined


Does anyone know how to solve this?

Thanks in advance!

share|improve this question

mod_jk directives aren't inherited by virtual hosts by default. Either move the mod_jk directives inside the virtual host or use the JkMountCopy directive. See the mod_jk docs for details.

If that still doesn't work, take a look at the mod_jk log. You may wish to turn it up to debug level until things are working as required. While you are at it, cleaning up your wouldn't hurt:

  • remove the workers.* properties that don't do anything
  • remove the ps=/ line
  • remove the load balancing entries you aren't using

They are probably not causing the problem but they certainly aren't helping. Keep things as simple as possible until it works.

share|improve this answer
Which directives? All of them? If you said about JkMount, the result is the same.. =/ – Jayme May 9 '12 at 15:53
As per the docs I linked you to, it varies by directive but JkMount and JkUnmount are the main ones. I'll update the answer with some further info. – Mark Thomas May 9 '12 at 16:09
The docs were the first place I went, but they just say what which directive do, not how. The examples they provide, when provide, are horrible, just make sense to users experienced on it. =/ I still trying to make things work, but they still, actually, the same... >< – Jayme May 9 '12 at 18:22

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.