Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Tomcat Users »

Apache 2 Tomcat4.1.27 name based virtual hosts

John Bell

2003-10-01

Replies:

Hi,

In Apache http.conf I have name based virtual hosts.

If I have capucino.co.uk as the first virtual host (default) then a request to freshlyroastcoffee.biz is ignored

and www.freshlyroastcoffee.biz goes to the capucino site.

If I put freshlyroastcoffe first then all is fine and capucino is picked up but I cannot see where I am going wrong

whether its a typo or just got it wrong.

# Use name-based virtual hosting.

NameVirtualHost *

#<VirtualHost *>

<VirtualHost *>

    ServerAdmin sales@(protected)

    DocumentRoot /coffeemy

    ServerName www.capucino.co.uk

    ErrorLog logs/capucino.error_log

    CustomLog logs/capucino.co.uk-access_log combined

</VirtualHost>

<VirtualHost *>

    ServerAdmin sales@(protected)

    DocumentRoot /coffeepp

    ServerName www.freshlyroastcoffee.biz

    ErrorLog logs/freshlyroastcoffee.error_log

    CustomLog logs/freshlyroastcoffee.biz-access_log combined

</VirtualHost>

include D:\ApacheTomcat\Tomcat-4.1\conf\jk\mod_jk.conf

In mod_jk_conf :-

JkMount /coffeemy ajp13

JkMount /coffeemy/* ajp13

JkMount /coffeemy/*.jsp ajp13



JkMount /coffeepp ajp13

JkMount /coffeepp/* ajp13

JkMount /coffeepp/*.jsp ajp13



In Tomcat's server.xml



<Context path="/coffeemy" docBase="d:\coffeemy" debug="0" reloadable="true" crossContext="true">

<Logger className="org.apache.catalina.logger.FileLogger" prefix="coffeemy_log." suffix=".txt" timestamp="true"/>

</Context>



<Context path="/coffeepp" docBase="d:\coffeepp" debug="0"reloadable="true" crossContext="true">

<Logger className="org.apache.catalina.logger.FileLogger" prefix="coffeepp_log." suffix=".txt" timestamp="true"/>

</Context>

Regards,

John
©2008 junlu.com - Jax Systems, LLC, U.S.A.