Apache Web-Serving with Mac OS X: Part 1
Subject:   configuration httpd.conf
Date:   2001-12-08 11:19:39
Considering this is the O'Reilly Web site I expected this simple introduction to ramp up quickly from intro remarks to something a bit more technical. For example, mention of the file located at: /etc/httpd/httpd.conf. How about a few words on what things one might want to change at a minimum in the Apache configuration file (and what role this file plays).
Full Threads Oldest First

Showing messages 1 through 10 of 10.

  • Morbus Iff photo configuration httpd.conf
    2001-12-08 14:14:08  Morbus Iff | O'Reilly Author [View]

    Yup, you can expect all that stuff in the second part, which is really the intro to that file, exploring it as we learn about CGI, and also a teensy bit about the httpd daemon itself.
    • configuration httpd.conf
      2001-12-10 17:41:08  sjmagy [View]

      Are you going to touch upon the .conf file that is also unique to each user?

      I was working just this past weekend on setting up Apache for the very first time (following instructions from a MacWorld article). After editing httpd.conf and enabling the options I wanted, I *still* couldn't see sites ("Forbidden -- you don't have access, blah blah") even though I should have according to the conf file.

      Turns out, as I was browsing around, if you have multiple users set up on your OS X box, the system creates a username.conf file for each user, which is in the etc/httpd/users directory path. If you don't also edit that file, then certain options don't get turned on, even if they are turned on in the main httpd.conf file.

      Primarily, I was trying to enable "Includes" and turn off "Indexes". If I didn't edit my own username.conf file to also enable "Includes", the functionality just plain didn't work....

      If you can provide some more thorough info. RE: access control, etc..., that would also be great!
      • Morbus Iff photo configuration httpd.conf
        2001-12-10 17:48:31  Morbus Iff | O'Reilly Author [View]

        Sjmagy, we won't be specifically touching on the user .conf files because they don't fall into the example intranet that were building in the series. However, we will go into SSI's and turning them on, as well as access control. Modifications that we make to the httpd.conf for those features can also be entered (with no change in syntax) into your specific user .conf files.
    • configuration httpd.conf
      2001-12-10 12:08:53  loren3 [View]

      no doubt... i learned from this page that i had to type:


      i had been frustrated that i was typing just http://<myip> and I was getting the apache default page even tho i had already replaced the index.html file in my ~/Sites/ folder.

      so that clarified that much.

      but what if you don't want to use your short name? how do you reconfigure it so that:

      a) it goes straight to your user index.html file with http://myip (without having to build your site in the /Library/WebServer directory...)


      b) create some kind of alias so that each user can have his/her own page but not necessarily use their short name to define it, as in:

      http://myip/~animals (for the site owned by user "morbus") and http://myip/~cars (for the site owned by user "Joe")


      also, is there ANY decent WYSIWYG html editor for OS X??

      and... How do you use BBEDIT to create a simple go to blah link???? believe it or not I couldn't figure that out.

      • configuration httpd.conf
        2001-12-10 14:28:38  bbicapslock [View]

        Straight to user index file:

        Change <Directory "/Library/WebServer/Documents"> to <Directory "/Users/whatever/Sites"> ("whatever" should be replaced by your short name.)

        Different users to different pages:
        If it's not going to be systematic then you'll need one line for each user. One way to do it is to use alias, for example, to alias cars and Joe from your example.

        You could also create some rewrite rules and let mod_rewrite take care of it.

        (Check the apache doc files shipped with OSX for syntax.)
      • configuration httpd.conf
        2001-12-10 13:36:09  djwudi [View]

        Since BBEdit is 'just' a text processor, the easiest way to put a link in is to just type the HTML code for the link in. Since you added the link to go to blah link to your post, I'm assuming you know that much HTML code, so it should work fine.

        Don't know about WYWIWYG editors, though - personally, I've never liked them. I've been coding my site with BBEdit, Pepper (another OS X text editor), or vi ('cause I'm a glutton for punishment) long enough that I've never liked any WYSIWYG editor I've played with.

        For pages under URLs such as http://yourip/animals/ or http://yourip/cars/ and such, those would just be subdirectories within...well...

        (My apologies if I'm jumping ahead in the lessons here...)

        As morbus said, the url http://yourip/~yourname/ points to your /Users/yourname/sites/ directory. However, the base url http://yourip/ points to the /Library/WebServer/Documents/ directory. Creating a subdirectory called 'cars' in there would give a system path of /Library/WebServer/Documents/cars/ that would be accessible from the outside as http://yourip/cars/ and would display whatever was inside the 'cars' directory. That's the easiest way that I can think of. The user (Joe, in your example) would still have to navigate to that folder rather than having it residing in his home directory...but if you really wanted to then, I suppose some creative aliasing could take care of that.
        • configuration httpd.conf
          2001-12-11 15:25:50  loren3 [View]

          thanks for the reply...

          with regard to subdirectories issue:

          1. i would want to avoid users--including myself once i got apache set up--from mucking about in the /Library directory! not a good idea IMHO.

          2. i've had terrible experience with aliases when it comes to system files in OS X, such that my principle is don't do it. i created some hard symbolic links and mucked things up badly before.

          3. i did find a suitable solution, which is to create an account with and set up free domain names linked to your ip (or dynamic ip). then you can set up the httpd.conf file to use virtual hosts, which is pretty easy to do. so each user can have his/her own domain name and have that go to anywhere it his/her user directory.

          with regards to bbedit, yeah sure i can code a simple link. but so what? bbedit has a whole markup toolbar to do nifty things wiht GUI like inserting inline images. The one thing I can't figure out immediately is how to create a link with that toolbar.

          unlike many hardcore html coders, i'd rather use dialog boxes than manually do all the tags.

          • configuration httpd.conf
            2002-02-02 12:32:22  mac_yoda [View]

            Where are all the BBEdit users?

            Hit the "Anchor" or the "Image" buttons in the "HTML tools" bar to get the dialogs you are looking for.
      • Morbus Iff photo configuration httpd.conf
        2001-12-10 12:50:02  Morbus Iff | O'Reilly Author [View]

        loren3, to answer your questions:

        a) It's possible. Probably the quickest way to do so is to go into your httpd.conf file, search for "/Library/Webserver/Documents" and replace it with the full path to your user directory. When you see a line that says something like "<Directory /Library/Webserver/Documents>", then that's the place you want to change. Messing around with the httpd.conf is touched upon in later parts of this series.

        b) Possible, but will not be touched upon in this series of articles. Generically speaking, the "~" is special in the sense that it denotes a username - if you really wanted "animals" and "cars" owned by separate users, then you should just do http://myip/animals/ and http://myip/cars/. That's left for you to figure out though.

        As for WYSIWIGs, dunno, never used them. As for BBEdit, this is the wrong place to ask ;) ...
        • configuration httpd.conf
          2001-12-10 13:20:33  loren3 [View]

          - if you really wanted "animals" and "cars" owned by separate users, then you should just do http://myip/animals/ and http://myip/cars/. That's left for you to figure out though.

          ...sorry i can't figure that out... that's why i came here looking for clues, not being a web admin or anything.

          my only guess is that you would have to set up some kind of redirect from a main page. but i don't know enough about either that level of html or about relative path names to figure that out.

          i've already run into problems trying to link to images outside of the sites folder (even in the ~/Pictures/ directory!) with relative pathnames and apparent lack of privs.