Alias question (1.3.27)

Alias question (1.3.27)

am 06.06.2007 21:45:58 von szr

Hello. I'm using Apache 1.3.27 and I've encountered a small problem
using Alias'es.

Say I have the following directory structure:

/var/www/html
/var/www/abc_html
/var/abc/data


and this in my httpd.conf:

Alias /abc/ "/var/www/abc_html/"
Alias /abc/data/ "/var/abc/data"


If I enter the following URL's in my browser:

http://host/abc/

I get the contents of /var/www/abc_html like I would expect, but
entering:

http://host/abc/data/

Doesn't give me the contents of /var/abc/data, but instead yield a 404
and in the error_log:

... File does not exist: /var/www/abc_html/data


Keep in mind this describes exactly what I'm doing, reduced to it's
basic parts for clarity sake.

Is there any reason why it wont work?

Seems the only way I could get round this was to use AliasMatch, it that
feels like a hack for something that seems like it should be so basic.

(And yes I know I could always use a symlink, but in my particular case
I need to avoid that and do it via httpd.conf, as this actually involves
a cross platform system we're developing.

Thank you.

-szr

Re: Alias question (1.3.27)

am 06.06.2007 23:11:54 von Mark Taylor

"szr" wrote in news:f472tu015q4
@news5.newsguy.com:

> Hello. I'm using Apache 1.3.27 and I've encountered a small problem
> using Alias'es.
>
> Say I have the following directory structure:
>
> /var/www/html
> /var/www/abc_html
> /var/abc/data
>
>
> and this in my httpd.conf:
>
> Alias /abc/ "/var/www/abc_html/"
> Alias /abc/data/ "/var/abc/data"
>
>
> If I enter the following URL's in my browser:
>
> http://host/abc/
>
> I get the contents of /var/www/abc_html like I would expect, but
> entering:
>
> http://host/abc/data/
>
> Doesn't give me the contents of /var/abc/data, but instead yield a 404
> and in the error_log:
>
> ... File does not exist: /var/www/abc_html/data
>
>
> Keep in mind this describes exactly what I'm doing, reduced to it's
> basic parts for clarity sake.
>
> Is there any reason why it wont work?
>
> Seems the only way I could get round this was to use AliasMatch, it
that
> feels like a hack for something that seems like it should be so basic.
>
> (And yes I know I could always use a symlink, but in my particular case
> I need to avoid that and do it via httpd.conf, as this actually
involves
> a cross platform system we're developing.
>
> Thank you.
>
> -szr
>
>
>

Probably because mod_alias finds the first occurance of /abc/ and,
finding a match it executes and terminates. Then again, I'm not real sure
alias works with two levels of directories. I suspect not.

I'm wondering exactly what you are trying to do. If your data directory
really contains data is there are real reason why you want it in the
directory root structure? Usually data paths are outside of the http root
for security reasons. You are explicitly putting the data in the http
path eliminating security. Of course, this may be exactly what you want
to do....



----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----

Re: Alias question (1.3.27)

am 07.06.2007 00:31:23 von szr

Mark Taylor wrote:
> szr wrote:
>
> > Hello. I'm using Apache 1.3.27 and I've encountered a small problem
> > using Alias'es.
> >
> > Say I have the following directory structure:
> >
> > /var/www/html
> > /var/www/abc_html
> > /var/abc/data
> >
> >
> > and this in my httpd.conf:
> >
> > Alias /abc/ "/var/www/abc_html/"
> > Alias /abc/data/ "/var/abc/data"
> >
> >
> > If I enter the following URL's in my browser:
> >
> > http://host/abc/
> >
> > I get the contents of /var/www/abc_html like I would expect, but
> > entering:
> >
> > http://host/abc/data/
> >
> > Doesn't give me the contents of /var/abc/data, but instead yield a
> > 404 and in the error_log:
> >
> > ... File does not exist: /var/www/abc_html/data
> >
> >
> > Keep in mind this describes exactly what I'm doing, reduced to it's
> > basic parts for clarity sake.
> >
> > Is there any reason why it wont work?
> >
> > Seems the only way I could get round this was to use AliasMatch, it
> > that feels like a hack for something that seems like it should be so
> > basic.
> >
> > (And yes I know I could always use a symlink, but in my particular
> > case I need to avoid that and do it via httpd.conf, as this actually
> > involves a cross platform system we're developing.
> >
> > Thank you.
> >
> > -szr
> >
> >
> >
>
> Probably because mod_alias finds the first occurance of /abc/ and,
> finding a match it executes and terminates. Then again, I'm not real
> sure alias works with two levels of directories. I suspect not.
>
> I'm wondering exactly what you are trying to do. If your data
> directory really contains data is there are real reason why you
> want it in the directory root structure? Usually data paths are
> outside of the http root for security reasons. You are explicitly
> putting the data in the http path eliminating security. Of course,
> this may be exactly what you want to do....

Thank you for replying. The scenario I described was just one I made up
on the fly to describe the problem I was having with the Alias
directive.

It doesn't seem to make any sense that I could, for instance, do the
following and it works as expected:

Alias /somewebapp/foo.pl "/var/www/html/somewebapp/foo_linux.pl"

but not be able to have more than one level:

Alias /abc/data/ "/var/abc/data"

(syntatically they would be the same, no?)


Thanks again.

--
szr

Re: Alias question (1.3.27)

am 07.06.2007 19:50:46 von Mark Taylor

"szr" wrote in
news:f47ck401edj@news5.newsguy.com:

> Mark Taylor wrote:
>> szr wrote:
>>
>> > Hello. I'm using Apache 1.3.27 and I've encountered a small problem
>> > using Alias'es.
>> >
>> > Say I have the following directory structure:
>> >
>> > /var/www/html
>> > /var/www/abc_html
>> > /var/abc/data
>> >
>> >
>> > and this in my httpd.conf:
>> >
>> > Alias /abc/ "/var/www/abc_html/"
>> > Alias /abc/data/ "/var/abc/data"
>> >
>> >
>> > If I enter the following URL's in my browser:
>> >
>> > http://host/abc/
>> >
>> > I get the contents of /var/www/abc_html like I would expect, but
>> > entering:
>> >
>> > http://host/abc/data/
>> >
>> > Doesn't give me the contents of /var/abc/data, but instead yield a
>> > 404 and in the error_log:
>> >
>> > ... File does not exist: /var/www/abc_html/data
>> >
>> >
>> > Keep in mind this describes exactly what I'm doing, reduced to it's
>> > basic parts for clarity sake.
>> >
>> > Is there any reason why it wont work?
>> >
>> > Seems the only way I could get round this was to use AliasMatch, it
>> > that feels like a hack for something that seems like it should be so
>> > basic.
>> >
>> > (And yes I know I could always use a symlink, but in my particular
>> > case I need to avoid that and do it via httpd.conf, as this actually
>> > involves a cross platform system we're developing.
>> >
>> > Thank you.
>> >
>> > -szr
>> >
>> >
>> >
>>
>> Probably because mod_alias finds the first occurance of /abc/ and,
>> finding a match it executes and terminates. Then again, I'm not real
>> sure alias works with two levels of directories. I suspect not.
>>
>> I'm wondering exactly what you are trying to do. If your data
>> directory really contains data is there are real reason why you
>> want it in the directory root structure? Usually data paths are
>> outside of the http root for security reasons. You are explicitly
>> putting the data in the http path eliminating security. Of course,
>> this may be exactly what you want to do....
>
> Thank you for replying. The scenario I described was just one I made up
> on the fly to describe the problem I was having with the Alias
> directive.
>
> It doesn't seem to make any sense that I could, for instance, do the
> following and it works as expected:
>
> Alias /somewebapp/foo.pl "/var/www/html/somewebapp/foo_linux.pl"
>
> but not be able to have more than one level:
>
> Alias /abc/data/ "/var/abc/data"
>
> (syntatically they would be the same, no?)
>
>
> Thanks again.
>

Ok, I found documentation that says that it will work, but when you have
multiple layers of directories you must list the directives in the most
specific order first since mod_alias will execute and terminate as soon
as it finds a match. Therefore the following will not work:

Alias /abc/ "/var/www/abc_html/"
Alias /abc/data/ "/var/abc/data"

But this will...

Alias /abc/data/ "/var/abc/data"
Alias /abc/ "/var/www/abc_html/"



Cheers...

----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----

Re: Alias question (1.3.27)

am 07.06.2007 21:17:19 von szr

Mark Taylor wrote:
> "szr" wrote in
> news:f47ck401edj@news5.newsguy.com:

[...]

> > Thank you for replying. The scenario I described was just one I
> > made up on the fly to describe the problem I was having with the
> > Alias directive.
> >
> > It doesn't seem to make any sense that I could, for instance, do the
> > following and it works as expected:
> >
> > Alias /somewebapp/foo.pl "/var/www/html/somewebapp/foo_linux.pl"
> >
> > but not be able to have more than one level:
> >
> > Alias /abc/data/ "/var/abc/data"
> >
> > (syntatically they would be the same, no?)
> >
> >
> > Thanks again.
> >
>
> Ok, I found documentation that says that it will work, but when you
> have
> multiple layers of directories you must list the directives in the
> most
> specific order first since mod_alias will execute and terminate as
> soon
> as it finds a match. Therefore the following will not work:
>
> Alias /abc/ "/var/www/abc_html/"
> Alias /abc/data/ "/var/abc/data"
>
> But this will...
>
> Alias /abc/data/ "/var/abc/data"
> Alias /abc/ "/var/www/abc_html/"

Thank you. I knew there was something really stupid-obvious I had to be
missing :)

> Cheers...

--
szr