1

I am trying to set-up a proper configuration to have Apache serve some static html pages and to pass other requests for dynamic pages to Tomcat. So far, I have installed Apache2 and Tomcat6 successfully.

I am trying to follow the instructions available here. I am stuck at step 4. There is a 000-default file in my /etc/apache2/sites-enabled directory. The content is:

<VirtualHost *:80>
        ServerAdmin webmaster@localhost

        DocumentRoot /var/www
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

        ErrorLog /var/log/apache2/error.log

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

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

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>

The instructions I am following say:

In your /etc/apache2/sites-enabled/ dir find the vhost you want to use tomcat and edit it, at the end of the vhost declaration put:

#Everything under root goes to tomcat
JkMount  /* worker1
#html files should be served by apache2
JkUnMount /*.html worker1

I would like to have tomcat handle requests to http://mywebsite.com/MyTomcatApp1/ or http://mywebsite.com/MyTomcatApp2/ (dynamic content) and all requests to http://mywebsite.com/ to be handled by Apache (static content).

How should I configure 000-default? I don't really understand the logic of JkMount and JkUnMount... Thanks.

Jérôme Verstrynge
  • 4,787
  • 7
  • 24
  • 35

1 Answers1

1

Assuming you've followed the rest of the instructions about creating workers.properties and loading the mod_jk module, you just need lines like:

JkMount /MyTomcatApp1/* worker1
JkMount /MyTomcatApp2/* worker1

They need to be somewhere in your Apache config that will be read for the mywebsite.com domain. That may be 000-default or it may be somewhere else -- only you know your own Apache configuration.

Mike Scott
  • 7,993
  • 31
  • 26