《Apache Cookbook》简介:

There's plenty of documentation on installing and configuring the Apache web server, but where do you find help for the day-to-day stuff, like adding common modules or fine-tuning your activity logging? That's easy. The new edition of the Apache Cookbook offers you updated solutions to the problems you're likely to encounter with the new versions of Apache. Written by members of the Apache Software Foundation, and thoroughly revised for Apache versions 2.0 and 2.2, recipes in this book range from simple tasks, such installing the server on Red Hat Linux or Windows, to more complex tasks, such as setting up name-based virtual hosts or securing and managing your proxy server. Altogether, you get more than 200 timesaving recipes for solving a crisis or other deadline conundrums, with topics including:

Security

Aliases, Redirecting, and Rewriting

CGI Scripts, the suexec Wrapper, and other dynamic content techniques

Error Handling

SSL

Performance

This book tackles everything from beginner problems to those faced by experienced users. For every problem addressed in the book, you will find a worked-out solution that includes short, focused pieces of code you can use immediately. You also get explanations of how and why the code works, so you can adapt the problem-solving techniques to similar situations. Instead of poking around mailing lists, online documentation, and other sources, rely on the Apache Cookbook for quick solutions when you need them. Then you can spend your time and energy where it matters most.

《Apache Cookbook》摘录:

Problem You want to prevent other Web sites from using your images (or other types of documents) in their pages and allow your images to be accessed only if they were referred from your own site. Solution Put this in your httpd.conf: RewriteEngine On RewriteCond "%{HTTP_REFERER}" !="" RewriteCond "%{HTTP_REFERER}" "!^http://mysite.com/.*$" [NC] RewriteRule ".(jpg|gif|png)$ - [F] Discussion This recipe is a series of RewriteCond directives, designed to determine whether an image file is requested from within a document on your site or if it is embedded in a page from another server. If the the latter, then the other site is stealing your images and needs to be stopped. The first rule checks to see if the referer is even set. Some clients don’t send a referer, and some browsers can be co...