05.01.2013 Views

Mac OS X Leopard - ARCAism

Mac OS X Leopard - ARCAism

Mac OS X Leopard - ARCAism

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

390<br />

CHAPTER 22 LEOPARD AS A WEB SERVER<br />

One thing to keep in mind is that there are permissions entries for every known directory,<br />

including the document root. If you change a directory elsewhere in the configuration, you will<br />

have to be sure to change its permissions entry as well. This is one of the reasons why using symbolic<br />

links is easier than editing the configuration file.<br />

DirectoryIndex<br />

Easily missed amidst all the permissions directives, the DirectoryIndex directive defines the<br />

default index file name. That is to say, when a user simply points to a directory, which file do<br />

they get? The default is index.html, which is why you don’t have to type index.html all the time<br />

when you’re surfing the Web.<br />

If you decide to start using PHP or some other technology that requires you to use a different<br />

file name or extension, you can edit this. By including multiple listings, you can give several<br />

possible defaults. Apache will server up the first one it finds. For example, to serve index.html by<br />

default, but to serve the old Microsoft FrontPage standard, welcome.html, as a backup, you would<br />

say the following:<br />

DirectoryIndex index.html welcome.html<br />

If nothing listed in DirectoryIndex exists, visitors will see a listing of everything in the directory.<br />

To prevent that, you can put a failsafe at the end of the DirectoryIndex directive, such as a<br />

reference to a file in your root directory telling people to stop poking around in your directories:<br />

DirectoryIndex index.html welcome.html /lost.html<br />

Logging<br />

There are several directives related to logging. You can customize where logs are kept, how much<br />

logging Apache should do, and what format log messages are in. These are best kept to the<br />

default values, but if you spend a lot of time reading your logs and you develop an opinion on<br />

some aspect of logging, here is where you can flex your will.<br />

Redirects<br />

Much like the DocumentRoot directive, the Redirect, Alias, and ScriptAlias directives let you<br />

map the URLs people request to your file system.<br />

Redirect will actually cause the browser to request a new location. This is useful if you’ve<br />

permanently moved a file to elsewhere on the system. Alias will cause a given path to look outside<br />

the normal document root hierarchy.<br />

For example, you might want to give the outside world access to your Pictures directory<br />

(for some reason) by mapping requests to www.yoursite.com/pictures to /Users/username/Pictures.<br />

You could, of course, also accomplish this with symbolic links, assuming you allow FollowSym-<br />

Links on the directory.<br />

ScriptAlias is like Alias, but it applies specifically to directories that contain executable<br />

scripts, rather than simple documents.<br />

DefaultType<br />

Most of the Internet uses MIME types to determine how it should deal with files. Since most web<br />

servers serve web pages, it’s appropriate to leave this set to the default, text/plain.<br />

NOTE MIME stands for Multipurpose Internet Mail Extensions. Like most of the Internet, it<br />

has been expanded beyond its original purpose.

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

Saved successfully!

Ooh no, something went wrong!