Location, Location, Location: Tips for Storing Web Site Files
Subject:   Correction
Date:   2003-05-17 11:07:58
From:   icalshare
Response to: Option 1 (~/Sites folder) BADLY wrong???

I will add a clarification on this issue ASAP. In the meantime, here are two options:

(1) If you're running OS X in single-user mode (which I suspect is the case for most of you) and want to keep things simple, just enable the DocumentRoot option in your Apache config file (/etc/httpd/httpd.conf/).

DocumentRoot "/Users/your_user_name/Sites/"

Doing this will allow you to serve files from your Sites folder without appending your user name to the localhost address (as specified in my first example).

(2) If you need to run in multi-user mode, just append the relevant user name to the localhost examples in the first section.

So, '' would become ' your_user_name/', and so on.


Full Threads Newest First

Showing messages 1 through 2 of 2.

  • Correction <-- comments on
    2003-05-17 14:10:20  anonymous2 [View]

    Two nit-picky notes:

    Be careful with the phrase "single-user mode"--I know you mean that only one person ever uses the machine; it auto-logs-them-in; they never think of "logging out", only shutting down; and so on. But in technical terms, "single-user mode" on OS X means holding down apple-s at startup, which boots you straight to a root shell (no password) instead of the gui. It's intended to save a broken machine by giving you full command-line access. Also, you may confuse people because there is no "setting" for single-user mode vs multi-user mode--it's just the existence of other gui accounts or not. So maybe say something about being the "sole user of the machine", or it being a "shared machine with multiple accounts".

    DocumentRoot is already "enabled" (set to /Library/WebServer/Documents). You'd want to *change* its value, which is a perfectly good idea. But then you have some confusion about what .conf file controls what--you can edit /etc/httpd/users/username.conf and ignore the main directives in httpd.conf, or you could change the main <Directory> block in httpd.conf and comment out your username.conf file (so it won't override your earlier settings).

    Sorry to be pushy, but I spend a good bit of time in forums answering similar questions and there is no point in confusing people unnecessarily with published material...
    • Correction <-- comments on
      2005-02-24 15:17:54  CTth [View]

      1. I am so glad to have read this article. Great service.
      2.. Before I read the article, I spent several hours tinkering my way through adding aliases and virtual hosts in an effort to change the root folder while maintaining a "clean" URL. Finally it dawned on me that all I really had to do (for my ends) was edit the DocumentRoot reference in the httpd.conf file to point at my folder of choice. This answered all my needs, and I suspect it's all most of the people reading this article are really looking for.
      3. As an easily confused person, I concurr with Mr. "Two nit-picky notes" that the wording could have been more presise in your message spelling out the DocumentRoot solution. But no biggee.
      4. Even though I figured out that I could edit DocumentRoot, it wasn't until I read your message that I realized it was totaly "okay" to do this. Call me a worrywart. I was concerned, because no one spelled this out in the face of so many forums and articles concentrating on aliases and virtual hosts. So, I'm glad it came to light.
      5. Last thing: I do not like how Apache automatically indexes directories and publishes thier contents to anonymous web users. Seems like this should be turned off by default. I know this is not within the direct scope of your article, but turning this OFF was the very next thing I found myself tinkering my way through. I ended up commenting out the two lines that load mod_autoindex. That said, I think this might be a heavy handed approach and I am now wondering if there's a more granular way to turn this off (so that I might be able to turn it on for some directories)?
      Thanks again for the article.