Can I have two virtual hosts with same servername?

Can I have two virtual hosts with same servername?

am 09.04.2010 11:44:46 von Michael Ni

--001636ed6dfa500dae0483caa5ac
Content-Type: text/plain; charset=ISO-8859-1

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


ServerName www.foobar.com


AddDefaultCharset Off
Order deny,allow
Allow from all


ProxyPass / ajp://localhost:8009/
ProxyPassReverse / ajp://localhost:8009/



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"




HOWEVER,
we want to do the following instead
http://www.foobar.com
http://www.foobar.com/blog

why does the following NOT work?


ServerName www.foobar.com


AddDefaultCharset Off
Order deny,allow
Allow from all


ProxyPass / ajp://localhost:8009/
ProxyPassReverse / ajp://localhost:8009/



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"


--001636ed6dfa500dae0483caa5ac
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

I have a java project that resides in tomcat.=A0 Recently we needed to add
Wordpress (php project).=A0

We decided to go with Apache Server=20
in front with virtual hosts with mod_proxy_ajp.

So far I have=20
gotten different server names to work


http://www.foobar.=
com

http://blo=
g.foobar.com


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

  =A0 =A0
   <Proxy *>
     AddDefaultCharset O=
ff
     Order=20
deny,allow
     Allow from all
   </Proxy>
=A0 r>  =20
ProxyPass / ajp://localhost:8009/
   ProxyPassReverse /=20
ajp://localhost:8009/

</VirtualHost>

<VirtualHost *:80>
  =A0 ServerNam=
e =


  
ErrorLog "C:/Program Files/Apache Software Foundation/Apache2.2/logs/=

error.log"

   DocumentRoot "C:/Program Files/Apache Software=20
Foundation/Apache2.2/htdocs"
</VirtualHost>



HO=
WEVER,

we want to do the following instead
m/" target=3D"_blank">http://www.foobar.com


http://www.foobar.=
com/blog


why
does the following NOT work?

<VirtualHost *:80>

   ServerName www.=
foobar.com


  =A0 =A0

   <Proxy *>

     AddDefaultCharset Off

     Order deny,allow

     Allow from all

   </Proxy>

=A0

   ProxyPass / ajp://localhost:8009/

   ProxyPassReverse / ajp://localhost:8009/

</VirtualHost>



<VirtualHost *:80>

  =A0 ServerName w=
ww.foobar.com

  =A0
ServerPath /blog



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

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

</VirtualHost>




--001636ed6dfa500dae0483caa5ac--

Re: Can I have two virtual hosts with same servername?

am 09.04.2010 11:48:54 von Nilesh Govindrajan

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://blog.foobar.com
>
>
> ServerName www.foobar.com
>
>
> AddDefaultCharset Off
> Order deny,allow
> Allow from all
>

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

>
>
> 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"
>

>
>
>
> HOWEVER,
> we want to do the following instead
> http://www.foobar.com
> http://www.foobar.com/blog
>
> why does the following NOT work?
>
>
> ServerName www.foobar.com
>
>
> AddDefaultCharset Off
> Order deny,allow
> Allow from all
>

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

>
>
> 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"
>

>
>

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
मेरा भारत महान !
मम भारत: महत्तम भवतु !

------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org

Re: Can I have two virtual hosts with same servername?

am 09.04.2010 11:52:43 von Michael Ni

--001636d3496ab513650483cac145
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

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 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://blog.foobar.com
>>
>>
>> ServerName www.foobar.com
>>
>>
>>
>> AddDefaultCharset Off
>> Order deny,allow
>> Allow from all
>>

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

>>
>>
>> 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"
>>

>>
>>
>>
>> HOWEVER,
>> we want to do the following instead
>> http://www.foobar.com
>> http://www.foobar.com/blog
>>
>> why does the following NOT work?
>>
>>
>> ServerName www.foobar.com
>>
>>
>>
>> AddDefaultCharset Off
>> Order deny,allow
>> Allow from all
>>

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

>>
>>
>> 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"
>>

>>
>>
>>
> 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
> मेरा भारत=
महान !
> मम भारत: मà=A4=
¹à¤¤à¥à¤¤à¤=AE भवतà=A5=
=81 !
>
> ------------------------------------------------------------ ---------
> The official User-To-User support forum of the Apache HTTP Server Project=
..
> See for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> " from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>

--001636d3496ab513650483cac145
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

we actually are doing

http://=
www.foobar.com/blog
instead of http:=
//blog.foobar.com
for SEO reasons.

we hope linking to the blog w=
ill boost up the the main site.


i have NameVirtualHost *:80


but do i really need server alias?



uote">On Fri, Apr 9, 2010 at 2:48 AM, Nilesh Govindarajan ><> wr=
ote:

r-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
>On 04/09/10 15:14, Michael Ni wrote:

border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
=3D"im">
I have a java project that resides in tomcat.  Recently we needed to a=
dd

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://ww=
w.foobar.com/
>

http://blog.foobar.com=
<http://blog.=
foobar.com/
>



<VirtualHost *:80>

   ServerName ">www.foobar.com < k">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 nk">blog.foobar.com < blank">http://blog.foobar.com/>




   ErrorLog "C:/Program Files/Apache Software Foundation/Ap=
ache2.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 a> <http://www.foob=
ar.com/
>

http://www.foobar.=
com/blog




why does the following NOT work?



<VirtualHost *:80>

   ServerName ">www.foobar.com < k">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 k">www.foobar.com < nk">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. r>


--

Nilesh Govindarajan

Site & Server Administrator



मेरा भारत =
महान !

मम भारत: मह=
त्तम भवतु !=




------------------------------------------------------------ ---------

The official User-To-User support forum of the Apache HTTP Server Project.<=
br>
See <URL: lank">http://httpd.apache.org/userslist.html> for more info.

To unsubscribe, e-mail: g" target=3D"_blank">users-unsubscribe@httpd.apache.org

 "   from the digest: cribe@httpd.apache.org" target=3D"_blank">users-digest-unsubscribe@httpd.ap=
ache.org


For additional commands, e-mail: org" target=3D"_blank">users-help@httpd.apache.org






--001636d3496ab513650483cac145--

Re: Can I have two virtual hosts with same servername?

am 09.04.2010 15:46:15 von Rich Bowen

--Apple-Mail-1-455799856
Content-Type: text/plain;
charset=US-ASCII;
format=flowed;
delsp=yes
Content-Transfer-Encoding: 7bit


On Apr 9, 2010, at 5:44 AM, 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.

> we want to do the following instead
> http://www.foobar.com
> http://www.foobar.com/blog



You're looking for the ProxyPass directive

A more thorough answer was given to you on the dev@httpd mailing list,
although the posting did in fact rightly belong here.


--
Rich Bowen
rbowen@rcbowen.com




--Apple-Mail-1-455799856
Content-Type: text/html;
charset=US-ASCII
Content-Transfer-Encoding: quoted-printable

-webkit-line-break: after-white-space; ">

On Apr 9, 2010, =
at 5:44 AM, Michael Ni wrote:

class=3D"Apple-interchange-newline">
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.
<snip>
type=3D"cite">
iv>


You're looking for the ProxyPass =
directive

A more thorough answer was given to you on =
the dev@httpd mailing list, although the posting did in fact rightly =
belong here.


apple-content-edited=3D"true"> style=3D"border-collapse: separate; color: rgb(0, 0, 0); font-family: =
Helvetica; font-size: medium; font-style: normal; font-variant: normal; =
font-weight: normal; letter-spacing: normal; line-height: normal; =
orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; =
white-space: normal; widows: 2; word-spacing: 0px; =
-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: =
0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: =
auto; -webkit-text-stroke-width: 0px; ">
break-word; -webkit-nbsp-mode: space; -webkit-line-break: =
after-white-space; ">
--
Rich Bowen

div>

=

=

--Apple-Mail-1-455799856--

Re: Can I have two virtual hosts with same servername?

am 09.04.2010 19:31:59 von Nilesh Govindrajan

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 > > 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://blog.foobar.com
>
>
> ServerName www.foobar.com
>
>
>
>
> AddDefaultCharset Off
> Order deny,allow
> Allow from all
>

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

>
>
> 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"
>

>
>
>
> HOWEVER,
> we want to do the following instead
> http://www.foobar.com
> http://www.foobar.com/blog
>
> why does the following NOT work?
>
>
> ServerName www.foobar.com
>
>
>
>
> AddDefaultCharset Off
> Order deny,allow
> Allow from all
>

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

>
>
> 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"
>

>
>
>
> 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
> मेरा भारत महान !
> मम भारत: महत्तम भवतु !
>
> ------------------------------------------------------------ ---------
> The official User-To-User support forum of the Apache HTTP Server
> Project.
> See for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>
> " from the digest: users-digest-unsubscribe@httpd.apache.org
>
> For additional commands, e-mail: users-help@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 for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org

Re: Can I have two virtual hosts with same servername?

am 10.04.2010 11:16:08 von Michael Ni

--001636c9268dbae0120483de5c41
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

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



ProxyPass /blog/ http://blog.foobar.com:80/

ServerName blog.foobar.com
DocumentRoot "C:/Program Files/Apache Software
Foundation/Apache2.2/htdocs"




ServerName www.foobar.com


AddDefaultCharset Off
Order deny,allow
Allow from all


ProxyPass / ajp://localhost:8009/
ProxyPassReverse / ajp://localhost:8009/


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/

ServerName www.foobar.com


Options FollowSymLinks
AllowOverride None
Order deny,allow
Allow from all


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




ServerName www.foobar.com


AddDefaultCharset Off
Order deny,allow
Allow from all


ProxyPass / ajp://localhost:8009/
ProxyPassReverse / ajp://localhost:8009/


On Fri, Apr 9, 2010 at 10:31 AM, Nilesh Govindarajan wrot=
e:

> 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 >> > 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://blog.foobar.com
>>
>>
>> ServerName www.foobar.com
>>
>>
>>
>>
>> AddDefaultCharset Off
>> Order deny,allow
>> Allow from all
>>

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

>>
>>
>> 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"
>>

>>
>>
>>
>> HOWEVER,
>> we want to do the following instead
>> http://www.foobar.com
>> http://www.foobar.com/blog
>>
>> why does the following NOT work?
>>
>>
>> ServerName www.foobar.com
>>
>>
>>
>>
>> AddDefaultCharset Off
>> Order deny,allow
>> Allow from all
>>

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

>>
>>
>> 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"
>>

>>
>>
>>
>> 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
>>
>> मेरा भारà=
¤¤ महान !
>> मम भारत: मà=
¤¹à¤¤à¥à¤¤à¤® भवतà=
¥ !
>>
>> ------------------------------------------------------------ ---------
>> The official User-To-User support forum of the Apache HTTP Server
>> Project.
>> See for more info.
>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>>
>>
>> " from the digest: users-digest-unsubscribe@httpd.apache.org
>>
>>
>> For additional commands, e-mail: users-help@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 t=
he
> java part.
>
> Keep only www.foobar.com vhost and configure it as I said above.
>
>
> --
> Nilesh Govindarajan
> Site & Server Administrator
> www.itech7.com
> मेरा भारत=
महान !
> मम भारत: मà=A4=
¹à¤¤à¥à¤¤à¤=AE भवतà=A5=
=81 !
>
> ------------------------------------------------------------ ---------
> The official User-To-User support forum of the Apache HTTP Server Project=
..
> See for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> " from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>

--001636c9268dbae0120483de5c41
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

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




ProxyPass =C2=
=A0    /blog/     ">http://blog.foobar.com:80/

<VirtualHost *:80>
e=3D"white-space:pre"> ServerName >blog.foobar.com
   DocumentRoot "C:/Program F=
iles/Apache Software Foundation/Apache2.2/htdocs"

   
  
</VirtualHost&g=
t;
<VirtualHost *:80>
   ServerName href=3D"http://www.foobar.com">www.foobar.com
Apple-tab-span" style=3D"white-space:pre">  

   <Proxy *>
     AddDefaultC=
harset Off
     Order deny,allow
 =
    Allow from all
   </Proxy>
v> 
   ProxyPass        / =C2=
=A0ajp://localhost:8009/

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

however if i try to use the s=
ame servername with different ports (shown below), i get error
cl=
ient denied by server configuration c:/apache


NameVirtualHost ">97.93.122.1:8888

ProxyPass     =C2=
=A0/blog/     http://www.=
foobar.com:8888/

<VirtualHost 97.93.122.1:8888 a>>
=
ServerName >


<Directory "C:/Program Files/Apache Software Fo=
undation/Apache2.2/htdocs">
    Options Fo=
llowSymLinks
    AllowOverride None
=C2=
 Â=A0  Order deny,allow
    Allow from al=
l

</Directory>
   
  =
  DocumentRoot "C:/Program Files/Apache Software Foundation/=
Apache2.2/htdocs"
   
  <=
/div>
</VirtualHost>

   ServerName www.foobar.c=
om
=
 
   <Proxy *>
  =
  AddDefaultCharset Off
     Order deny,allo=
w

     Allow from all
   </Proxy&g=
t;
 
   ProxyPass       =
 /  ajp://localhost:8009/
   ProxyPassReverse=
/  ajp://localhost:8009/
</VirtualHost>
r>
On Fri, Apr 9, 2010 at 10:31 AM, Nilesh Govindar=
ajan < lank">lists@itech7.com> wrote:

left:1px solid rgb(204, 204, 204);padding-left:1ex">
On 04/09/10 15:22,=
Michael Ni wrote:

order-left:1px solid rgb(204, 204, 204);padding-left:1ex">

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 < ists@itech7.com" target=3D"_blank">lists@itech7.com
=

<mailto:lists@itec=
h7.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 wi=
th virtual hosts with

       mod_proxy_ajp.



       So far I have gotten different server names to =
work



        ank">http://www.foobar.com < t=3D"_blank">http://www.foobar.com/>

        lank">http://blog.foobar.com < rget=3D"_blank">http://blog.foobar.com/>



       <VirtualHost *:80>

           ServerName foobar.com" target=3D"_blank">www.foobar.com < foobar.com" target=3D"_blank">http://www.foobar.com>

       < =3D"_blank">http://www.foobar.com/>





       <Proxy *>

             AddDefaultCharset Off

             Order deny,allow

             Allow from all

       </Proxy>



           ProxyPass / ajp://localhost:8009/=


           ProxyPassReverse / ajp://localhos=
t:8009/

       </VirtualHost>



       <VirtualHost *:80>

            ServerName g.foobar.com" target=3D"_blank">blog.foobar.com < log.foobar.com" target=3D"_blank">http://blog.foobar.com>

       < =3D"_blank">http://blog.foobar.com/>





           ErrorLog "C:/Program Files/A=
pache Software

       Foundation/Apache2.2/logs/

       error.log"

           DocumentRoot "C:/Program Fil=
es/Apache Software

       Foundation/Apache2.2/htdocs"

       </VirtualHost>







       HOWEVER,

       we want to do the following instead

        ank">http://www.foobar.com < t=3D"_blank">http://www.foobar.com/>

        =3D"_blank">http://www.foobar.com/blog



       why does the following NOT work?



       <VirtualHost *:80>

           ServerName foobar.com" target=3D"_blank">www.foobar.com < foobar.com" target=3D"_blank">http://www.foobar.com>

       < =3D"_blank">http://www.foobar.com/>





       <Proxy *>

             AddDefaultCharset Off

             Order deny,allow

             Allow from all

       </Proxy>



           ProxyPass / ajp://localhost:8009/=


           ProxyPassReverse / ajp://localhos=
t:8009/

       </VirtualHost>



       <VirtualHost *:80>

            ServerName ..foobar.com" target=3D"_blank">www.foobar.com < ..foobar.com" target=3D"_blank">http://www.foobar.com>

       < =3D"_blank">http://www.foobar.com/>



            ServerPath /blog



           ErrorLog "C:/Program Files/A=
pache Software

       Foundation/Apache2.2/logs/error.log"

           DocumentRoot "C:/Program Fil=
es/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.itech=
7.com
<http://ww=
w.itech7.com
>


   मेरा भाà¤=
°à¤¤ महान !

   मम भारत: =E0=
¤®à¤¹à¤¤à¥à¤¤à¤=AE भव=E0=
¤¤à¥=81 !



   ------------------------------------------------------ -------=
--------

   The official User-To-User support forum of the Apache HTTP Se=
rver

   Project.

   See <URL: " target=3D"_blank">http://httpd.apache.org/userslist.html> for more=
info.

   To unsubscribe, e-mail: ttpd.apache.org" target=3D"_blank">users-unsubscribe@httpd.apache.org r>

   <mailto: rg" target=3D"_blank">users-unsubscribe@httpd.apache.org>
   <mailto: pache.org" target=3D"_blank">users-digest-unsubscribe@httpd.apache.org&=
gt;



If you want /blog and not nk">blog.foobar.com then it should work, I see that you haven't add=
ed the DocumentRoot.



Once you add a DocumentRoot, use LocationMatch directive to forward request=
s to servlets and jsps to tomcat, else you'll end up in 404s for the ja=
va part.



Keep only www.foobar.co=
m
vhost and configure it as I said above.




--

Nilesh Govindarajan

Site & Server Administrator



मेरा भारत =
महान !

मम भारत: मह=
त्तम भवतु !=




------------------------------------------------------------ ---------

The official User-To-User support forum of the Apache HTTP Server Project.<=
br>
See <URL: lank">http://httpd.apache.org/userslist.html> for more info.

To unsubscribe, e-mail: g" target=3D"_blank">users-unsubscribe@httpd.apache.org

 "   from the digest: cribe@httpd.apache.org" target=3D"_blank">users-digest-unsubscribe@httpd.ap=
ache.org


For additional commands, e-mail: org" target=3D"_blank">users-help@httpd.apache.org






--001636c9268dbae0120483de5c41--