tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Heather Buch" <hb...@www.thebuchs.dk>
Subject Re: jkmounts screwing up my namevirtualhost
Date Mon, 30 Jun 2003 08:31:28 GMT
Hi John,

As it turns out, what got me unstuck was to add a Host and Context to
server.xml, as you and Lajos both recommended to me. 

But it seems I can use 

NameVirtualHost *
<VirtualHost *>
...
</VirtualHost>

or 

NameVirtualHost 127.0.0.1
<VirtualHost 127.0.0.1>
....
</VirtualHost>

To be honest, I still don't really understand the difference
between the two. I am hoping to access http://oecon-stprg from the network, so
perhaps I will have to remap my /etc/hosts file to my real IP address, in whic
h case I will have to change my VirtualHost and NameVirtualHost stuff.

In any case, it works now and your advice was helpful. Here is another article
 which also helped. It contains some stuff on VirtualHost configuration:

http://www.onjava.com/pub/a/onjava/2003/06/25/tomcat_tips.html

Best,

Heather Buch

On Fri, 27 Jun 2003 09:22:52 -0400, John Turner wrote
> If you want multiple name-based virtual hosts with JK, I have found 
> that you need to do the following:
> 
> - make sure NameVirtualHost is enabled and set to "*"
> 
> - make sure all VirtualHost containers look like this:
> 
> <VirtualHost *>
>   ServerName your.host.name
>   ...
>   JkMount /*.jsp ajp13
> </VirtualHost>
> 
> - make sure that every possible value of ServerName is also defined 
> in server.xml either as a Host or an Alias to a Host.
> 
> You're getting the default web-app because Tomcat doesn't have a 
> virtual host defined for "127.0.0.1", nor should it (technically) as 
> virtual hosts are typically name-based.  Most likely you have 
> virtual hosts for "localhost" and "ocean-stprg", but as far as 
> Tomcat is concerned, neither of those is equal to "127.0.0.1", which 
> is probably the host header it is getting from Apache.
> 
> I have this configuration currently setup for 6 hosts, it is working 
> perfectly.  If you take the "127.0.0.1" out of your VirtualHost 
> containers and instead use the "*" and follow the other things above,
>  you should be fine.  You'll also want to make sure that you 
> designate a separate appBase for each Host in server.xml.
> 
> John
> 
> On Fri, 27 Jun 2003 12:14:54 +0100, Heather Buch 
> <hbuch@www.thebuchs.dk> wrote:
> 
> > Hello,
> >
> > My NameVirtualHost fails when I try to set the JkMount directives.
> >
> > I am using
> > httpd-2.0.43
> > jakarta-tomcat-4.1.12
> > (I am also using jakarta-struts-1.0.2, but this might not be so relevant 
> > to my
> > problem)
> >
> > Here is my setup (I describe the problem at the end using the specific 
> > names
> > that appear in the config file snippets below):
> >
> > 1. in /etc/hosts:
> >
> > # Do not remove the following line, or various programs
> > # that require network functionality will fail.
> > 127.0.0.1               localhost.localdomain localhost
> > 127.0.0.1               oecon-stprg
> > 127.0.0.1               oecon-admprg
> > 12.38.84.60             heather
> >
> > 2. In httpd.conf:
> >
> > NameVirtualHost 127.0.0.1
> >
> > Here is my "catch all" localhost virtual host:
> >
> > <VirtualHost 127.0.0.1>
> > ServerAdmin admin@localhost
> > ServerAlias localhost.localdomain localhost
> > DocumentRoot "/usr/local/bin/server-1.0/apache2/htdocs"
> > ServerName localhost
> > ErrorLog logs/localhost_error.log
> > CustomLog logs/localhost_access.log common
> > </VirtualHost>
> >
> > 3. in mod_jk.conf-local
> >
> > Here is the virtual host that I am trying to work with:
> >
> > <VirtualHost 127.0.0.1>
> > DocumentRoot
> > "/usr/local/bin/server-1.0/jakarta-tomcat-4.1.12/webapps/oecon-stprg/"
> > ServerName oecon-stprg
> > ServerAlias oecon-stprg
> > ServerAdmin hbuch@thebuchs.dk
> >
> > # Deny direct access to WEB-INF and META-INF
> > <Location "WEB-INF/*">
> > AllowOverride None
> > deny from all
> > </Location>
> > <Location "META-INF/*">
> > AllowOverride None
> > deny from all
> > </Location>
> > <Directory "/usr/local/bin/server-1.0/jakarta-tomcat- 
> > 4.1.12/webapps/oecon-stprg">
> > Options Indexes FollowSymLinks
> > 	order	allow,deny
> > 	allow	from all
> > DirectoryIndex login.jsp </Directory>
> >
> > JkMount /*.do ajp13
> > JkMount /servlet/*.jsp ajp13
> > JkMount /*.jsp ajp13
> >
> > #ErrorLog logs/oecon-stprg_error.log
> > #CustomLog logs/oecon-stprg_access.log common
> > </VirtualHost>
> >
> >
> > ----------------------
> >
> > The problem is - when I call up my virtual host url (http://oecon-stprg) 
> > and
> > comment out the JkMount directives, apache gives me the proper document 
> > root
> > ("/usr/local/bin/server-1.0/jakarta-tomcat-4.1.12/webapps/oecon-stprg/") 
> > but
> > of course then Tomcat can't handle jsp pages because there are no JkMount
> > directives. When I uncomment the JkMounts and call up my virtual host, 
> > Apache
> > does not send me to the DocumentRoot that I have defined in my oecon- 
> > stprg
> > VirtualHost, but instead to the default tomcat webapp.
> >
> > In other words, the presence of this in my VirtualHost block:
> >
> > JkMount /*.do ajp13
> > JkMount /servlet/*.jsp ajp13
> > JkMount /*.jsp ajp13
> >
> > causes Apache to deliver the files under here:
> >
> > /usr/local/bin/server-1.0/jakarta-tomcat-4.1.12/webapps/ROOT
> >
> > intead of the ones under here:
> >
> > /usr/local/bin/server-1.0/jakarta-tomcat-4.1.12/webapps/oecon-stprg
> >
> > I hope I have explained this well enough to get a reply. I have struggled 
> > for
> > two days now. I read the document at
> > http://www.galatea.com/flashguides/virtual-hosting.xml as I generally 
> > think
> > the Galatea guides are very good. However, it describes setting up the
> > JkMounts under a subdirectory, for example,
> >
> > JkMount /test ajp13
> > JkMount /test/* ajp13
> >
> > and not at the root, as I would like to do. I want to be able to call up
> >
> > http://oecon-stprg/login.jsp
> >
> > not
> >
> > http://oecon-stprg/test/login.jsp
> >
> > but maybe I need that subdirectory?
> >
> > Thanks very much in advance,
> >
> > Heather Buch
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> >
> >
> 
> -- 
> Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Heather Buch


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message