Handling Symbolic Links


Options FollowSymLinks


In Unix, a symbolic link (or symlink) is a special kind of file that points to another file. It is created with the Unix ln command and is useful for making a certain file appear in different places.

Two of the parameters that the Options directive allows are FollowSymLinks and SymLinksIfOwnerMatch. By default, Apache won't follow symbolic links because they can be used to bypass security settings and provide unwanted access to parts of your filesystem. For example, you can create a symbolic link from a public part of the website to a restricted file or directory not otherwise accessible via the Web. So, also by default, Apache needs to perform a check to verify that the file isn't a symbolic link. If SymLinksIfOwnerMatch is present, it will follow a symbolic link if the target file is owned by the same user who created the symbolic link. Because those tests must be performed for every path element and for every path that refers to a file system object, they can be expensive. If you control the content creation, you should add an Options +FollowSymLinks directive to your configuration and avoid the SymLinksIfOwnerMatch argument. In this way, the tests won't take place and performance isn't affected.

Disabling Per-directory Configuration Files

<Directory /> AllowOverride none </Directory>


As explained in previous chapters, per-directory configuration files provide a convenient way of configuring the server and allow for some degree of delegated administration. However, if this feature is enabled, Apache has to look for these files in each directory in the path leading to the document being served. You can disable this feature by adding AllowOverride none to your configuration.

Configuring Content Negotiation

As explained in the "Configuring Content Negotiation" section in Chapter 4, Apache can serve different versions of a file depending on client language or preferences. This can be accomplished with file extensions, but for every request, Apache must access the file system repeatedly looking for files with appropriate extensions. If you need to use content negotiation, make sure that you at least use a type-map file, minimizing accesses to disk.

Disabling or Minimizing Logging

BufferedLogs On


In heavily loaded websites, logging can slow down the server significantly. You can minimize its impact by not logging hits to all or certain images (such as navigational buttons). Additionally, you can buffer logs before they are written to disk using the BufferedLogs directive included in mod_log_config in Apache 2 and later. Finally, you can decide to use modules such as mod_log_spread that allow you to log to the network instead of to local disk, improving performance. You can download this module from http://www.backhand.org/mod_log_spread.




Apache(c) Phrase Book(c) Essential Code and Commands
Apache Phrasebook
ISBN: 0672328364
EAN: 2147483647
Year: 2006
Pages: 254

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net