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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

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

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

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

---------------------------------------------------------------------
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-unsubscribe@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux