I run virtualhost with 18 sitenames, each having its own subdirectory system, 
running off of ONE server, all with the SAME IP address, just different names. 
SOME referenced from a DYNAMIC NAME SERVER, some static... AND multiple names 
could come to the SAME site, and based on the NAME could be set up through PHP 
etc to choose a different set of pages to show, etc. TRY PHP. You won't regret 
it.

See us online at http://www.LOVEnCompany.com.

---------- Original Message ----------
From: André Warnier <a...@ice-sa.com>
To: users@httpd.apache.org
Subject: Re: [us...@httpd] VirtualHost with no ServerName in 2.2.11
Date: Fri, 15 May 2009 00:37:58 +0200

Tony Ser wrote:
> Thanks for the reply.
> 
> What we are trying to do is to create a new vhost without disrupting the 
> default settings.
> 
> So that http://localhost/whatever/... Follow the default setup while
> http://localhost/testsite/... Will refer to /var/www/company/yyy/public
> 
> 
> I did look into the suggested link but most examples on multiple vhosts rely 
> on either different port, different ip address, or different name but in our 
> case they are all the same. It is just a path that we want to take over.
> 
> I realize the default DocumentRoot /var/www takes over all requests, and I am 
> just wonder if there is a way override it just for a particular path 
> "testsite". Or do we always need to edit the default config?
> 
> Editing the default config is fine for a particular server but we are working 
> on a web application, to be deployed on different machines. Would be nice if 
> we could just add our own vhost configuration without messing with the 
> default.
> 
> 
Well, that's a bit different from what you requested in the first iteration.

I believe that what you are trying to achieve will be difficult to do 
"in all generality", because these different hosts are likely to have 
different configurations to start with.
For example, not all of them may be configured to use VirtualHosts in 
the first place.

But assuming that they all are, I think you cleanest bet at this stage 
would be to add another VirtualHost, but with a different hostname, 
rather than trying to play with a sub-directory or Alias.

In any case, you cannot use a <VirtualHost> section just to redefine a 
part of an existing webserver.  That is not what VirtualHosts are for, 
nor how they work.

Thus, suppose you have a site which currently responds to 
"http://host1.company.com";, and has its document base in /var/www (or 
wherever).
And you want to add a "test site" with a different document base.  What 
you would then have to do is :

- in the DNS system of "company.com", create a new alias (in DNS linguo, 
that's a CN record) for this same host. For example 
"host1-test.company.com", as a new alias for "host1.company.com".

- then in the Apache config of that host, create a new VirtualHost 
section *after* the ones that already exist :

<VirtualHost *:80>
  ServerName host1-test.company.com
  DocumentRoot /somewhere/else
  .. whatever else you want there ..
</VirtualHost>

an then just put your test application under /somewhere/else (or under 
/somewhere/else/testsite if you prefer).

The above refers to the part "Name-based virtual hosts" in the 
previously-mentioned documentation.  IP-address based virtual hosting is 
something else altogether, not to be mixed or confused with this.


There may be other solutions based on mod_rewrite or Alias, but I 
believe that this will in the end be more complicated, and lead you into 
a bunch of issues of all kinds with relative URLs, authentication and 
authorization, existing aliases etc..

Using a separate virtual host as indicated above is like adding another 
webserver machine, completely separate from the original one, where the 
possibilities of mixup are limited.

I recommend you re-load this document :
http://httpd.apache.org/docs/2.2/vhosts/name-based.html
and re-read carefully in particular the section
"Using Name-based Virtual Hosts"
(Just ignore whatever it says about IP addresses, and use "*" for that.)




---------------------------------------------------------------------
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
____________________________________________________________
Click now to find great remedies for hangovers!
http://thirdpartyoffers.juno.com/TGL2131/fc/BLSrjnsJQcRBmpUEqH21ZSzcYMtfZrAjR9KjPxWN2VoFSoxpH0bVfTNUMoQ/

Reply via email to