tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject [OT: Apache] Re: Virtual Hosting with Apache and mod_jk
Date Wed, 02 Aug 2006 19:09:44 GMT

>        /*.jsp ajp13
>        /*.do ajp13

I assume these lines say "JkMount" before the paths...?

> This works great when I set up my hosts file to point
> to the correct IP of my server box.
> However, if I try to access the server directly by IP, I get a 403
> error.

Are you using "name based virtual hosting" -- meaning that the hostname
chooses the VirtualHost? Or, do you have multiple IP addresses pointing
to the same server, and you are using IP address to choose the virtual host.

If you are using "name based virtual hosting", then the ServerName head
is /required/ to make it work: you cannot get it to work using just the
IP address.

If you are /not/ using NameVirtualHost, then you should be able to get
your VirtualHost working by binding it to a specific IP address:

       DocumentRoot /opt/projects/www/com/townsfolkdesigns/web
       JkMount /*.jsp ajp13
       JkMount /*.do ajp13

Someone should verify this; I'm not an Apache expert, but this seems
like the right solution.

> My Second question is in regards to mod_rewrite, I want to be able to
> use mod_rewrite to easily host a couple other domains on the same box.
> Is there something like this for tomcat? I would like to be able to
> declare one Host element (with a simple context element) in the
> server.xml and have the requests directed to the correct paths. Is
> this possible?

Generally, this is done with separate VirtualHost entries in httpd.conf,
with a separate set of JkMount directives in each one: the configuration
is handled entirely in Apache, so you don't have to do anything weird in
your Tomcat configuration (as long as your <Engine>'s "defaultHost" is
set to the same value as your simple <Host> entry).

You do not need to use mod_rewrite to do this.

If you are going to be running separate applications for each
VirtualHost, I recommend running them in different instances of Tomcat.
This will allow you to administer them separately. Also, if you have to
take one of them offline (or one of them dies unexpectedly), the others
are not interrupted.


View raw message