Apache v2 Notes
Stuart Reedy, stu@uky.edu

v0.10, December 2, 2008
Copyright Stuart Reedy 2002-2008


These are just random notes that I've made about running Apache. Everything here assumes you've installed Apache (version 2.2.x) my way--using the prefix /home/httpd/--so if you didn't, you're on your own!


I) Running Apache under its own userid

Typically, I run the httpd service of Apache as its own userid: httpd
and with a special group: www

This is easily done:

  1. Create the group: groupadd www
  2. Then create the user: useradd -g www httpd
  3. Finally, in the file /home/httpd/conf/httpd.conf, where the User is set up, replace the original lines with:

      User httpd
      Group www
The above example sets the uid and gid to "the next available" (whatever that means). If you want to set specific values, use: This example uses 377 for both the uid and gid. You'll want to replace 377 with your value(s).

II) Making .shtml files (server-parsed html) work

This is really easy! Edit the file /home/httpd/conf/httpd.conf as follows:

  1. Uncomment the lines

    AddType text/html .shtml
    AddOutputFilter INCLUDES .shtml

  2. and after the line: <Directory "/home/httpd/htdocs"> add Includes to the options.

    Options Indexes FollowSymLinks Includes

  3. Optionally, you can add an entry for index.shtml to the DirectoryIndex line:

    DirectoryIndex index.html index.shtml

  4. For those brave of heart, you can even make the server parse .html files, by using the X-bit-hack.
    Somewhere between <Directory /home/httpd/htdocs> and </Directory>, just put the line:

    XBitHack Full

    With this option, any .html files marked as executable will be parsed.
    (To make a file executable just use: chmod a+x filename)

III) Testing the config file:

When you make changes to httpd.conf, you can check these changes using:

/home/httpd/bin/apachectl configtest

Final note:

Any time you edit the file /home/httpd/conf/httpd.conf, you must restart the web server to activate the changes. Try:

/home/httpd/bin/apachectl restart

Back to Stu's Apache Page

Back to Stu's Linux Page

last updated 12-02-2008 09:13 by Stuart Reedy
Copyright Stuart Reedy 2002-2008
All rights reserved