httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tom Evans <tevans...@googlemail.com>
Subject Re: Can I have two virtual hosts with same servername?
Date Fri, 09 Apr 2010 08:43:50 GMT
On Fri, Apr 9, 2010 at 6:43 AM, Michael Ni <michaelcni@gmail.com> wrote:
> I have a java project that resides in tomcat.  Recently we needed to add
> Wordpress (php project).
>
> We decided to go with Apache Server in front with virtual hosts with
> mod_proxy_ajp.
>
> So far I have gotten different server names to work
>
> http://www.foobar.com
> http://blog.foobar.com
>
> <VirtualHost *:80>
>    ServerName www.foobar.com
>
>    <Proxy *>
>      AddDefaultCharset Off
>      Order deny,allow
>      Allow from all
>    </Proxy>
>
>    ProxyPass / ajp://localhost:8009/
>    ProxyPassReverse / ajp://localhost:8009/
> </VirtualHost>
>
> <VirtualHost *:80>
>     ServerName blog.foobar.com
>
>    ErrorLog "C:/Program Files/Apache Software
> Foundation/Apache2.2/logs/error.log"
>    DocumentRoot "C:/Program Files/Apache Software
> Foundation/Apache2.2/htdocs"
> </VirtualHost>
>
>
>
> HOWEVER,
> we want to do the following instead
> http://www.foobar.com
> http://www.foobar.com/blog
>
> why does the following NOT work?
>
> <VirtualHost *:80>
>    ServerName www.foobar.com
>
>    <Proxy *>
>      AddDefaultCharset Off
>      Order deny,allow
>      Allow from all
>    </Proxy>
>
>    ProxyPass / ajp://localhost:8009/
>    ProxyPassReverse / ajp://localhost:8009/
> </VirtualHost>
>
> <VirtualHost *:80>
>     ServerName www.foobar.com
>     ServerPath /blog
>
>    ErrorLog "C:/Program Files/Apache Software
> Foundation/Apache2.2/logs/error.log"
>    DocumentRoot "C:/Program Files/Apache Software
> Foundation/Apache2.2/htdocs"
> </VirtualHost>
>
>

This shouldn't be on dev, it should be on users.

Read the manual section on virtual hosts for an explanation of why
what you tried does not work. However, it is trivial to do what you
wanted:


<VirtualHost *:80>
   ServerName www.foobar.com

   <Proxy *>
     AddDefaultCharset Off
     Order deny,allow
     Allow from all
   </Proxy>

   ErrorLog "C:/Program Files/Apache Software
Foundation/Apache2.2/logs/error.log"
   DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs"

   ProxyPass /blog !
   ProxyPass / ajp://localhost:8009/
   ProxyPassReverse / ajp://localhost:8009/

</VirtualHost>

Mime
View raw message