You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "Beauford.2003" <be...@rogers.com> on 2002/12/01 14:17:28 UTC

[users@httpd] More problem with Virtual Hosts

Hi,

I finally managed to some degree to get virtual hosts working, but now it
has created a host of other problems. I have two virtual hosts and my main
host (i.e. main.domain.com, one.domain.com, two.domain.com).

the files for main.domain.com are in /usr/local/apache/htdocs
the files for one.domain.com is are in /usr/local/apache/htdocs/one
the files for two.domain.com is are in /usr/local/apache/htdocs/two

When I type in one.domain.com this is what appears in the address bar of my
browser, but when I type in two.domain.com I see main.domain.com/two. Why is
this and how do I correct it so it shows two.domain.com.

The other problems I am having relate to paths. Some of my pages now don't
work because the paths are wrong, but can I figure out how to set them
right.

Example: one.main.com  is /usr/local/apache/htdocs/one/index.html which
opens the main page. but then I have other directories that I need to access
in /usr/local/apache/htdocs/other - so what is the path?

I would have assumed ../other but this does not work. Paths in Linux have
always been a source of confusion, and this is just another example.

Any help on this before I go insane is appreciated.

Beauford



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


Re: [users@httpd] More problem with Virtual Hosts

Posted by "Beauford.2003" <be...@rogers.com>.
Daniel,

Thanks for the info, I have been playing around with this all morning and
see exactly what you are saying. I have since moved everything for each host
into its proper directory - not trying to mess around with a so called
shared directories - this has made everything work as normal.

What had me confused, and you hit it on the head, was that
/usr/local/apache/htdocs/one/ is the top level directory, and doing a
../whatever will not work as I thought it would.

Thanks again.

----- Original Message -----
From: "Daniel Grace" <ru...@earthlink.net>
To: <us...@httpd.apache.org>
Sent: Saturday, November 30, 2002 10:10 AM
Subject: Re: [users@httpd] More problem with Virtual Hosts


> From: "Beauford.2003" <be...@rogers.com>
> To: <us...@httpd.apache.org>
> Sent: Sunday, December 01, 2002 5:17 AM
> Subject: [users@httpd] More problem with Virtual Hosts
>
>
> > Hi,
> >
> > I finally managed to some degree to get virtual hosts working, but now
it
> > has created a host of other problems. I have two virtual hosts and my
main
> > host (i.e. main.domain.com, one.domain.com, two.domain.com).
> >
> [snip]
> > the files for main.domain.com are in /usr/local/apache/htdocs
> > the files for one.domain.com is are in /usr/local/apache/htdocs/one
> > the files for two.domain.com is are in /usr/local/apache/htdocs/two
> >
> [snip]
> > The other problems I am having relate to paths. Some of my pages now
don't
> > work because the paths are wrong, but can I figure out how to set them
> > right.
> >
> > Example: one.main.com  is /usr/local/apache/htdocs/one/index.html which
> > opens the main page. but then I have other directories that I need to
> access
> > in /usr/local/apache/htdocs/other - so what is the path?
>
> Remember that paths in an HTML document are relative to how they appear to
> the client.  To the client, /usr/local/apache/htdocs/one/  (as viewed from
> http://one.domain.com/ ) *IS* the top level directory, thus ../ to go up
one
> level to /usr/local/apache/htdocs will not work like expected.  In fact,
it
> won't work at all. :)
>
> If you need to do this, you'll need to either use absolute pathnames
> complete with a URL to the correct virtual host, or you'll need to alias
> /usr/local/apache/htdocs into the one.domain.com domain.  Either the
> Alias/Scriptalias directives should do the job, or a symbol link if you
have
> Followsymlinks (?) on.  Note that either one of these will give you an
> oddity where someone on one.domain.com could open
> http://one.domain.com/parentdir/one/parentdir/one/parentdir/one/... -- as
> for whether this is a vulnerability or not, I really don't think so but it
> can lead to bad & confusing things if you're not careful.
>
> IMHO you'd be best off giving each host its own separate directory that
does
>  NOT contain any of the other vhosts directories in it, and then creating
a
> separate directory for all of the 'shared' stuff for all of your hosts and
> either aliasing it in or giving it a vhost of its own -- but that's just
my
> 2 cents worth.
>
> -- Daniel Grace
> Certified 99.9999% lurker
>
>
> ---------------------------------------------------------------------
> 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@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>



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


Re: [users@httpd] More problem with Virtual Hosts

Posted by Daniel Grace <ru...@earthlink.net>.
From: "Beauford.2003" <be...@rogers.com>
To: <us...@httpd.apache.org>
Sent: Sunday, December 01, 2002 5:17 AM
Subject: [users@httpd] More problem with Virtual Hosts


> Hi,
>
> I finally managed to some degree to get virtual hosts working, but now it
> has created a host of other problems. I have two virtual hosts and my main
> host (i.e. main.domain.com, one.domain.com, two.domain.com).
>
[snip]
> the files for main.domain.com are in /usr/local/apache/htdocs
> the files for one.domain.com is are in /usr/local/apache/htdocs/one
> the files for two.domain.com is are in /usr/local/apache/htdocs/two
>
[snip]
> The other problems I am having relate to paths. Some of my pages now don't
> work because the paths are wrong, but can I figure out how to set them
> right.
>
> Example: one.main.com  is /usr/local/apache/htdocs/one/index.html which
> opens the main page. but then I have other directories that I need to
access
> in /usr/local/apache/htdocs/other - so what is the path?

Remember that paths in an HTML document are relative to how they appear to
the client.  To the client, /usr/local/apache/htdocs/one/  (as viewed from
http://one.domain.com/ ) *IS* the top level directory, thus ../ to go up one
level to /usr/local/apache/htdocs will not work like expected.  In fact, it
won't work at all. :)

If you need to do this, you'll need to either use absolute pathnames
complete with a URL to the correct virtual host, or you'll need to alias
/usr/local/apache/htdocs into the one.domain.com domain.  Either the
Alias/Scriptalias directives should do the job, or a symbol link if you have
Followsymlinks (?) on.  Note that either one of these will give you an
oddity where someone on one.domain.com could open
http://one.domain.com/parentdir/one/parentdir/one/parentdir/one/... -- as
for whether this is a vulnerability or not, I really don't think so but it
can lead to bad & confusing things if you're not careful.

IMHO you'd be best off giving each host its own separate directory that does
 NOT contain any of the other vhosts directories in it, and then creating a
separate directory for all of the 'shared' stuff for all of your hosts and
either aliasing it in or giving it a vhost of its own -- but that's just my
2 cents worth.

-- Daniel Grace
Certified 99.9999% lurker


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