Changing The Web Root Directory On 10.2

7 posts / 0 new
Last post
davintosh's picture
Offline
Last seen: 10 years 2 weeks ago
Joined: Dec 20 2003 - 10:38
Posts: 554
Changing The Web Root Directory On 10.2

I'm trying to set up an old beige G3 to serve up some audio files via http, but I can't figure out how to specify which directory gets shared by 10.2's built-in Apache server. The machine is set up with two partitions on the main hard drive, and by default the web root ends up on the boot drive. For a variety of reasons, I'd like to serve those files from the much larger second partition, but I can't figure it out. Making an alias in the Finder doesn't work.

It's probably something stupid simple, but...

Has anybody done this before or know what file to modify to change it? Any other ideas?

Thanks!

Tiger G5 Kid's picture
Offline
Last seen: 18 years 1 month ago
Joined: Dec 20 2003 - 10:38
Posts: 134
Not Sure...

I've been tinkering around with Apache config files, and I think what you're looking for is in a file called httpd.conf. Not sure exactly where it is, but when you find it, the part to change to set the directory is easy to find. The file is well commented.

catmistake's picture
Offline
Last seen: 2 years 4 months ago
Joined: Dec 20 2003 - 10:38
Posts: 1100
locate

open terminal
type
locate httpd.conf

(Jag SHOULD have the locate command)

davintosh's picture
Offline
Last seen: 10 years 2 weeks ago
Joined: Dec 20 2003 - 10:38
Posts: 554
Got it!

The secret is to use "Symbolic Links" to direct the web user from the default root folder to a different directory/volume. A symbolic link is essentially an alias that also works in web and ftp servers.

Creating one is apparently a Terminal-only trick. The command goes something like this:


Where "source_file" is the name of the file you want to have linked to your shared web folder. In OS X Terminal it's even easier; just type in...

... then drag the file/folder you want to create a symbolic link from to the Terminal window. The file path automagically fills in. Hit Enter, and the link will be created in your home folder. Move that file to your web root folder, and voila! there it is!

I knew I should've paid closer attention in that Unix class!

Offline
Last seen: 18 years 4 weeks ago
Joined: Jan 22 2005 - 20:20
Posts: 595
The symbolic link...

I use the symbolic link quite frequently. If you're wanting to use Color_X in NetBSD on a 68k Mac, you gotta know the -s option for the ln command. Also, if you're haphazardly experimental (largely due to impatience), like myself, the symbolic link can be used to great effect in breaking a system.

Case in point:

I was attempting to add a precompiled package called VMS_Empire, when to my great surprise, I discovered that I did not have an older libcurses installed on my machine.

Yes, you can see where I'm going with this. I realized that I had just recently installed something called ncurses, and immediately, visions of the symbolic link danced freely through my organic computational devices. I reasoned, "Hmm, I'll just create a symbolic link from ncurses to the filname that VMS_Empire is looking for..."

Did it work? Incredibly, yes! Was it smart? Uh, don't think so!

The symbolic link -- gotta love it!

EDIT: I did not discover that my system was missing the older libcurses. On the contrary, the VMS_Empire package made the discovery and enlightened me. Unix has a tendency of doing that -- it enlightens its users.

davintosh's picture
Offline
Last seen: 10 years 2 weeks ago
Joined: Dec 20 2003 - 10:38
Posts: 554
The Holy Grail!

ServerLogistics is the place! There you can download an installer package to put Apache 2 on OS 10 (the standard Apache install on OS X is 1.something or other.) Their installer even comes with a System Preferences Pane to help you configure Apache! Too cool; that is exactly what I was looking for (I hate Terminal.)

From the pref pane you can start & stop the server, edit the config files (including what directory is used for your server files), and check the logs.

The installation is a breeze; basically download (2.0.47 for 10.2 or 2.0.52 for 10.3), decompress, double-click the installer package from the mounted disk image, click ok a couple of times, and you're set! What a cool flippin deal! It's even free (but definitely worth the optional donation.)

davintosh's picture
Offline
Last seen: 10 years 2 weeks ago
Joined: Dec 20 2003 - 10:38
Posts: 554
Re: Got it!

The secret is to use "Symbolic Links" to direct the web user from the default root folder to a different directory/volume. A symbolic link is essentially an alias that also works in web and ftp servers.

Creating one is apparently a Terminal-only trick. The command goes something like this:


Where "source_file" is the name of the file you want to have linked to your shared web folder. In OS X Terminal it's even easier; just type in...

... then drag the file/folder you want to create a symbolic link from to the Terminal window. The file path automagically fills in. Hit Enter, and the link will be created in your home folder. Move that file to your web root folder, and voila! there it is!

I knew I should've paid closer attention in that Unix class!

One thing to add to this... you need a space following the "-s" and preceding the the file path you drag into the Terminal window. I tried adding another symbolic link to the server that started this business, and struggled for a bit when it kept erroring on me. Adding the space is the magic bullet. Lesson learned.

Log in or register to post comments