Forum Moderators: phranque

Message Too Old, No Replies

List multiple directories

List Files Directories Multiple

         

smudge

11:08 pm on Apr 23, 2007 (gmt 0)

10+ Year Member



I just setup apache on my machine (windows for the first time as I usually compile on Linux) and am trying to serve files from multiple drives in multiple directories.

Having read thru httpd.conf I cannot understand how to list several directories. Lets say I have drives D:\ and E:\ with files I wish to share. I added D:\, it works, I add E:\ it doesn't work. How do I do this?

Also, the listing shows alphabetical list. I'd prefer to list with directories at the top, files beneath. Please advise!

smudge

11:11 pm on Apr 23, 2007 (gmt 0)

10+ Year Member



Also, listings titles are cropped. If all my listings are say 20 characters or less, how can I get a full description listing rather than a cropped version? Thanks.

jdMorgan

12:53 am on Apr 24, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Not sure specifically how you "added" E:\" so I can't address that question.

For the index formatting questions, see Apache mod_autoindex [httpd.apache.org]. See especially the note about the DescriptionWidth directive added in Apache1.3.10.

Jim

[edited by: jdMorgan at 12:53 am (utc) on April 24, 2007]

smudge

8:59 am on Apr 24, 2007 (gmt 0)

10+ Year Member



I added drive E:\ by changing the DocumentRoot "E:\" in httpd.conf.

Reading this config file it mentions something about Aliases but not sure how to use them, to add another drive? Sym links may work in Linux servers but not in windows, all you get is a F:\File.lnk and no functionality.

Any tips?

Thanks.

smudge

9:13 am on Apr 24, 2007 (gmt 0)

10+ Year Member



Also I can't seem to find mention of namewidth in any config file. I'm using the latest Apache server and it has probably been depreciated. I searched for strings NameWidth, 'width' and still didn't find anything other than notes in CHANGES.txt.

jdMorgan

3:00 pm on Apr 24, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can probably use Apache mod_alias to associate filepaths --including drives-- with URL namespaces. I suggest that you do this for both of your 'data' disks; There is no reason to 'expose' the actual disk structure of your server on the Web.

So you could, for example, alias "D:\" as "/widgets/blue-green" and "E:\" as "/widgets/red-yellow" and thereby hide any disk drive information for the URL-space. These are just dumb examples; I'm sure there is some better and more-descriptive URL-naming convention you can use to look at the requested URL and decide which drive the requested content is stored on.

Design this URL-to-filesystem "mapping" with an eye toward expansion: Make sure your mapping approach will accommodate both growth of the directories stored on any given disk -- meaning you may have to add a disk and change the Alias structure, and also the growth in the size of inexpensive disks -- meaning you may want to combine the contents of the two drives onto a single larger one.

See Apache mod_alias documentation for more info.

Jim

smudge

3:19 pm on Apr 24, 2007 (gmt 0)

10+ Year Member



Thanks for your reply.

I looked at [spinbox.techtracker.com...] to read more on this and tried to add your examples and as always, if the syntax is wrong, apache won't start. I added the following to httpd.conf:

Alias "L:\Pictures" as "/Pictures"
Alias "J:\General" as "/General"

This naturally failed to work.

The above link used this example:

Alias /image /ftp/pub/image
<Directory /ftp/pub/image>
Order allow,deny
Allow from all
</Directory>

But I don't know hot to use this with a route to L:\Pictures and J:\General. I know I'm asking the wrong questions but until I 'get' what I'm doing, I'm afraid I'm just fumbling around scratching my head.

smudge

3:30 pm on Apr 24, 2007 (gmt 0)

10+ Year Member



Ok I changed the above to read:

Alias /General "J:\General"
<Directory "J:\General">
Order allow,deny
Allow from all
</Directory>

This lists the contents of the drive IF I put the full path down in the url, so mysite.com/General

I want/am trying to list all my files on one page, so General and Pictures would just be a directory on the main Fancy Index page, the default page or www.mysite.com

Also when I added:

Alias /Video "L:\Pictures"
<Directory "L:\Pictures">
Order allow,deny
Allow from all
</Directory>

And typed this into the url or www.mysite.com/Pictures this DIDN'T work?

jdMorgan

4:28 pm on Apr 24, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



> I want/am trying to list all my files on one page, so General and Pictures would just be a directory on the main Fancy Index page, the default page or www.mysite.com

To do that, you'd need either SymLinks (not available on Windoze, as you stated), or a script to "virtualize" the filesystem. That is, write a script to output a "directory" that includes the other drives as if they were really in this directory of one drive, thereby creating a 'meta directory' of all drives and folders.

Bad news: It's more complicated. Good news: Since your script will 'write' the HTML to present the directory listing, you are free to format it in any way you like, free of mod_autoindex's restrictions and limitations.

I think I've read some discussion of this here in the past -- try a search in the WebmasterWorld PERL forum.

Jim