Thanks guys it worked using two unique servernames, blog.foobar.com and
www.foobar.com



ProxyPass      /blog/     http://blog.foobar.com:80/
<VirtualHost *:80>
ServerName blog.foobar.com
   DocumentRoot "C:/Program Files/Apache Software
Foundation/Apache2.2/htdocs"


</VirtualHost>
<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>

however if i try to use the same servername with different ports (shown
below), i get error
client denied by server configuration c:/apache

NameVirtualHost 97.93.122.1:8888

ProxyPass      /blog/     http://www.foobar.com:8888/
<VirtualHost 97.93.122.1:8888>
ServerName www.foobar.com

<Directory "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs">
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Allow from all
</Directory>

    DocumentRoot "C:/Program Files/Apache Software
Foundation/Apache2.2/htdocs"


</VirtualHost>
<VirtualHost 97.93.122.1:80>
   ServerName www.foobar.com

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

   ProxyPass        /  ajp://localhost:8009/
   ProxyPassReverse /  ajp://localhost:8009/
</VirtualHost>

On Fri, Apr 9, 2010 at 10:31 AM, Nilesh Govindarajan <li...@itech7.com>wrote:

> On 04/09/10 15:22, Michael Ni wrote:
>
>> we actually are doing
>>
>> http://www.foobar.com/blog instead of http://blog.foobar.com for SEO
>> reasons.
>>
>> we hope linking to the blog will boost up the the main site.
>>
>> i have NameVirtualHost *:80
>>
>> but do i really need server alias?
>>
>>
>>
>> On Fri, Apr 9, 2010 at 2:48 AM, Nilesh Govindarajan <li...@itech7.com
>> <mailto:li...@itech7.com>> wrote:
>>
>>    On 04/09/10 15:14, Michael Ni 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://www.foobar.com/>
>>        http://blog.foobar.com <http://blog.foobar.com/>
>>
>>        <VirtualHost *:80>
>>            ServerName www.foobar.com <http://www.foobar.com>
>>        <http://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 <http://blog.foobar.com>
>>        <http://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/>
>>        http://www.foobar.com/blog
>>
>>        why does the following NOT work?
>>
>>        <VirtualHost *:80>
>>            ServerName www.foobar.com <http://www.foobar.com>
>>        <http://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 <http://www.foobar.com>
>>        <http://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>
>>
>>
>>
>>    First of all, you need a NameVirtualHost *:80
>>
>>    Then you should use ServerAlias to add www to the vhost.
>>
>>    As a SEO point of view, you should redirect www to non-www or
>>    vice-versa.
>>
>>    --
>>    Nilesh Govindarajan
>>    Site & Server Administrator
>>    www.itech7.com <http://www.itech7.com>
>>
>>    मेरा भारत महान !
>>    मम भारत: महत्तम भवतु !
>>
>>    ---------------------------------------------------------------------
>>    The official User-To-User support forum of the Apache HTTP Server
>>    Project.
>>    See <URL:http://httpd.apache.org/userslist.html> for more info.
>>    To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
>>    <mailto:users-unsubscr...@httpd.apache.org>
>>
>>    "   from the digest: users-digest-unsubscr...@httpd.apache.org
>>    <mailto:users-digest-unsubscr...@httpd.apache.org>
>>
>>    For additional commands, e-mail: users-h...@httpd.apache.org
>>    <mailto:users-h...@httpd.apache.org>
>>
>>
>>
> If you want /blog and not blog.foobar.com then it should work, I see that
> you haven't added the DocumentRoot.
>
> Once you add a DocumentRoot, use LocationMatch directive to forward
> requests to servlets and jsps to tomcat, else you'll end up in 404s for the
> java part.
>
> Keep only www.foobar.com vhost and configure it as I said above.
>
>
> --
> Nilesh Govindarajan
> Site & Server Administrator
> www.itech7.com
> मेरा भारत महान !
> मम भारत: महत्तम भवतु !
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
>  "   from the digest: users-digest-unsubscr...@httpd.apache.org
> For additional commands, e-mail: users-h...@httpd.apache.org
>
>

Reply via email to