Mailing List Archive

Virtual Host
I was doing some more serious testing on the Virtual Host features
last night. I have a question that may be more of an HTML education
issue.

I have two servers running sharing the same document tree.
www1.org has a Document Root that can see the entire tree.
www2.org is a Virtual host that has a Document Root of /www2docs/

Within file1.html I have some absolute paths to other documents.
The sticky point began when trying to do image maps and accessing
/cgi-bin etc.

<A HREF="http:/www2docs/morefiles/morefile1.html> morefile</A>

http://www1.org/www2docs/file1.html

http://www2.org/file1.html

How can I serve this document tree from both servers?

It almost seems that we need to have seperate ScriptAlias
entries for the VirtualHost. Perhaps Alias entries that
apply only to the VirtualHost? ie 'Alias /www2docs/ /'.
Actually the server should probably automatically ignore
anything in a string that matches the DocumentRoot string
for the VirtualHost?
Re: Virtual Host [ In reply to ]
> >I have two servers running sharing the same document tree.
> >www1.org has a Document Root that can see the entire tree.
> >www2.org is a Virtual host that has a Document Root of /www2docs/
>
> Err, why??

Because www1.org has been serving the entire tree for some time
now. There are many registered links to that servername.


> >Within file1.html I have some absolute paths to other documents.
> >The sticky point began when trying to do image maps and accessing
> >/cgi-bin etc.
> >
> ><A HREF="http:/www2docs/morefiles/morefile1.html> morefile</A>
>
> I don't quite understand; your URL does not make sense. Why not
> http://www1.org/ww2docs/morefiles/morefile1.html ?

What you propose can be done with DNS. The real advantage of the
VirtualHost feature is that http://www2.org/ serves www2docs/index.html


> >http://www1.org/www2docs/file1.html
> >
> >http://www2.org/file1.html
> >
> >How can I serve this document tree from both servers?
>
> You probably can't, and shouldn't try.

Why?
Re: Virtual Host [ In reply to ]
> On Apr 21, 9:58am, Randy Terbush wrote:
> } Subject: Virtual Host
> }
> } I have two servers running sharing the same document tree.
> } www1.org has a Document Root that can see the entire tree.
> } www2.org is a Virtual host that has a Document Root of /www2docs/
>
>
> Well, if the host are sharing stuff, then there is indeed a problem. :(
>
> 1) It can be solved by (a) replication of front end scripts which use a real
> path and the DOCUMENT_ROOT variable to get the real work done.
>
> 2) Use only relative URLS and scripts (probably too late)
>
> 3) Create yet a third host with all the common stuff. use hidden fields
> and/or QUERY_STRING to tell it what to do for real.

Or 4) ignore the /host2root relative to the main tree. Why would this
not work? Is there an obvious reason why this would not work? It's
basically an 'Alias /host2root /' specific to the VirtualHost.
Re: Virtual Host [ In reply to ]
> Or 4) ignore the /host2root relative to the main tree. Why would this
> not work? Is there an obvious reason why this would not work? It's
> basically an 'Alias /host2root /' specific to the VirtualHost.
>
> Hmmm... could you get this effect by doing an "ln -s . host2root" in
> the physical host2root directory? (Of course, this only works for people
> who have FollowSymLinks on...).
>
> rst

I suppose that should work. What would be the expense of following
this symlink for *every* document access to this tree? Seems more
efficient to strip this from the URL in the server...
Re: Virtual Host [ In reply to ]
On Apr 21, 9:58am, Randy Terbush wrote:
} Subject: Virtual Host
}
} I have two servers running sharing the same document tree.
} www1.org has a Document Root that can see the entire tree.
} www2.org is a Virtual host that has a Document Root of /www2docs/


Well, if the host are sharing stuff, then there is indeed a problem. :(

1) It can be solved by (a) replication of front end scripts which use a real
path and the DOCUMENT_ROOT variable to get the real work done.

2) Use only relative URLS and scripts (probably too late)

3) Create yet a third host with all the common stuff. use hidden fields
and/or QUERY_STRING to tell it what to do for real.


Cliff
Re: Virtual Host [ In reply to ]
Or 4) ignore the /host2root relative to the main tree. Why would this
not work? Is there an obvious reason why this would not work? It's
basically an 'Alias /host2root /' specific to the VirtualHost.

Hmmm... could you get this effect by doing an "ln -s . host2root" in
the physical host2root directory? (Of course, this only works for people
who have FollowSymLinks on...).

rst
Re: Virtual Host [ In reply to ]
>I have two servers running sharing the same document tree.
>www1.org has a Document Root that can see the entire tree.
>www2.org is a Virtual host that has a Document Root of /www2docs/

Err, why??

>Within file1.html I have some absolute paths to other documents.
>The sticky point began when trying to do image maps and accessing
>/cgi-bin etc.
>
><A HREF="http:/www2docs/morefiles/morefile1.html> morefile</A>

I don't quite understand; your URL does not make sense. Why not
http://www1.org/ww2docs/morefiles/morefile1.html ?

>http://www1.org/www2docs/file1.html
>
>http://www2.org/file1.html
>
>How can I serve this document tree from both servers?

You probably can't, and shouldn't try.

>It almost seems that we need to have seperate ScriptAlias
>entries for the VirtualHost. Perhaps Alias entries that
>apply only to the VirtualHost? ie 'Alias /www2docs/ /'.
>Actually the server should probably automatically ignore
>anything in a string that matches the DocumentRoot string
>for the VirtualHost?

You can easily do this by having separate httpd's with separate
config files.

David.
Re: Virtual Host [ In reply to ]
I still don't see your problem...

>> >I have two servers running sharing the same document tree.
>> >www1.org has a Document Root that can see the entire tree.
>> >www2.org is a Virtual host that has a Document Root of /www2docs/
>>
>Because www1.org has been serving the entire tree for some time
>now. There are many registered links to that servername.

Ok. I suppose the easiest solution would be for www1.org to issue a redirect,
so that clients update their links. Better would be to send the document
with a Location header (is that right?)

>> >Within file1.html I have some absolute paths to other documents.
>> >The sticky point began when trying to do image maps and accessing
>> >/cgi-bin etc.
>> >
>> ><A HREF="http:/www2docs/morefiles/morefile1.html> morefile</A>
>>
>> I don't quite understand; your URL does not make sense. Why not
>> http://www1.org/ww2docs/morefiles/morefile1.html ?
>
>What you propose can be done with DNS. The real advantage of the
>VirtualHost feature is that http://www2.org/ serves www2docs/index.html

So make the link http://www2.org/morefiles/morefile1.html ?

David.