05.01.2013 Views

Mac OS X Leopard - ARCAism

Mac OS X Leopard - ARCAism

Mac OS X Leopard - ARCAism

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

What makes this directive interesting is actually the list of AddType and AddHandler directives,<br />

which allow you to add support for certain types of files. The list is begun with a<br />

TypesConfig directive that points to an external list of types, stored by default in /private/etc/<br />

apache2/mime.types.<br />

Most webmasters meet the types section when adding PHP support, as the traditional php<br />

file extension is not handled by default—although on <strong>Leopard</strong>, this is handled for you in the<br />

PHP configuration file.<br />

ErrorDocument<br />

If you ever go poking around the coolest sites on the Net, they always seem to have these sexy<br />

custom error pages, so pulling a 403: Access Denied doesn’t jar you from the overall design of<br />

the site. The ErrorDocument directive lets you point to custom pages and scripts.<br />

If you define a custom error document, be sure to actually implement it, lest your users not<br />

only be treated to a generic error page, but also be blighted with the ever embarrassing “Additionally,<br />

a 404 Not Found error was encountered while trying to use an ErrorDocument to<br />

handle the request.”<br />

Include<br />

Apache configuration is typically split into multiple files. External files are referred to using the<br />

Include directive. For the purposes of scope, you can consider the entire text of an included file<br />

to be inserted where the Include directive is used.<br />

This is important, because the general rule with Apache is that the last word is the one that’s<br />

obeyed. So, if an included file disagrees with the main file, the one farther down the list is going<br />

to win. If you find some configuration detail is not working, despite being clearly documented,<br />

make sure you’re not being overridden by another file.<br />

Of particular importance is this line:<br />

Include /private/etc/apache2/extra/httpd-userdir.conf<br />

Editing this file reveals two things. First, it uses the UserDir directive to tell Apache that<br />

every user’s personal root is their Sites directory. If, for example, you are from the old school<br />

and you’d prefer this directory to be called public_html, this is where you’d set that up.<br />

Second, this file in turn includes all .conf files contained in the directory /private/etc/<br />

apache2/users. Listing that directory reveals a series of files of the form username.conf, where<br />

username is a username on the system.<br />

Each of these files contains a permissions directive.<br />

<br />

Options Indexes MultiViews<br />

AllowOverride None<br />

Order allow,deny<br />

Allow from all<br />

<br />

CHAPTER 22 LEOPARD AS A WEB SERVER 391<br />

Again, username refers to the actual user name dealt with by the file.<br />

By default, all directories on your system are forbidden, except for those explicitly named.<br />

This directive makes the named user’s Sites folder readable and sets up a few options. Were<br />

this file to be missing, you would not be able to access your site, regardless of system-level<br />

permissions.<br />

When you turn on web sharing, these files are created by default. By editing the files, you<br />

can disallow certain users the ability to host sites. You could even remove the main include, disabling<br />

all user sites, while giving yourself the document root.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!