Apache is far and away the most widely used Web server platform available. This book lists common problems, their solutions, and practical examples--along with an impressive collection of useful code--for webmasters, administrators, and programmers.
Preface; What's in This Book; Platform Notes; Other Books; Other Sources; How This Book Is Organized; Conventions Used in This Book; Using Code Examples; We'd Like to Hear from You; Safari® Enabled; Acknowledgments; Chapter 1: Installation; 1.1 Installing installation from Red Hat Linux packages packages Red Hat Linux, installation from Red Hat Linux, packages, installation from from Red Hat Linux's Packages; 1.2 Debian, packages, installation from installation from Debian packages packages Debian, installation from Installing from Debian Packages; 1.3 Windows installation on Installing Apache installation on Windows on Windows; 1.4 Subversion downloading sources sources downloading Downloading the Apache downloads sources Sources; 1.5 Apache building from sources building Apache from sources sources building Apache from Building Apache from the Sources; 1.6 ApacheToolbox, installation with Installing with downloads ApacheToolbox installation ApacheToolbox and ApacheToolbox; 1.7 Apache starting starting Apache Starting, Apache stopping stopping Apache Stopping, and Apache restarting restarting Apache Restarting Apache; 1.8 Apache uninstalling uninstalling Apache Uninstalling Apache; 1.9 Which Apache versions Version of Apache to Use; 1.10 upgrades, config.nice and Upgrading Using config.nice config.nice; 1.11 boot, starting Apache at Starting Apache Apache starting at boot starting Apache at boot at Boot; 1.12 Useful configure script, options configure Options; 1.13 Finding Apache's files location Files; Chapter 2: Adding Common Modules; 2.1 Installing a Generic installation modules, third-party modules third-party third-party modules Third-Party Module; 2.2 Installing Unix mod_dav mod_dav on a installation mod_dav Unix mod_dav Unix Unixish System; 2.3 Installing Windows mod_dav mod_dav on installation mod_dav Windows mod_dav Windows Windows; 2.4 Installing installation mod_perl, Unix Unix mod_perl mod_perl on a mod_perl Unix Unixish System; 2.5 Installing Unix mod_php mod_php on a installation mod_php Unix mod_php Unix Unixish System; 2.6 Installing Windows mod_php mod_php on installation mod_php Windows mod_php Windows Windows; 2.7 Installing installation mod_ssl mod_ssl SSL (Secure Socket Layers) mod_ssl mod_ssl; 2.8 Finding Modules Using modules locating, modules.apache.org modules.apache.org modules.apache.org; 2.9 Installing installation mod_security mod_security; 2.10 Why Won't This modules troubleshooting Module Work?; Chapter 3: Logging; 3.1 Getting More logs entries, details Details in Your Log Entries; 3.2 Getting More error log, details logs error, details Detailed Errors; 3.3 POST, contents, logging Logging logs POST contents POST Contents; 3.4 clients, proxied, logging IP addresses IP addresses logging, proxied clients proxies clients, logging IP addresses Logging a logs proxied clients, IP addresses Proxied Client's IP Address; 3.5 MAC, addresses, logging Logging Client logs MAC addresses MAC Addresses; 3.6 cookies, logging Logging logs cookies Cookies; 3.7 Not Logging logs image requests, local pages Image Requests from Local Pages; 3.8 logs logfiles, rotating at specific times Rotating Logfiles at a Particular Time; 3.9 logs rotating Rotating Logs on the First of the Month; 3.10 hostnames logging Logging logs hostnames Hostnames Instead of IP Addresses; 3.11 Maintaining logs virtual hosts separate logs Separate Logs for Each Virtual Host; 3.12 proxies requests, logging Logging logs proxy requests Proxy Requests; 3.13 Logging logs errors, virtual hosts, multiple files Errors for Virtual Hosts to Multiple Files; 3.14 IP addresses servers, logging Logging logs server IP addresses Server servers IP addresses, logging IP Addresses; 3.15 Logging the logs referring page Referring Page; 3.16 browser, software name, logging software, browser, logging name Logging the logs browser software name Name of the Browser Software; 3.17 Logging logs arbitrary request header fields request header, arbitrary fields, logging Arbitrary Request Header Fields; 3.18 Logging logs arbitrary response header fields response header, arbitrary fields, logging Arbitrary Response Header Fields; 3.19 databases MySQL, logging activity Logging logs MySQL database activity MySQL database, logging activity Activity to a MySQL Database; 3.20 Logging logs to syslog to syslog; 3.21 Logging logs user directories User Directories; Chapter 4: Virtual Hosts; 4.1 Setting Up Name-Based Virtual Hosts; 4.2 Designating One Name-Based Virtual Host as the name-based virtual hosts default virtual hosts name-based default Default; 4.3 Setting Up address-based virtual hosts virtual hosts address-based setup Address-Based Virtual Hosts; 4.4 Creating a virtual hosts address-based default Default Address-Based Virtual Host; 4.5 virtual hosts address-based mixing with name-based virtual hosts name-based mixing with address-based Mixing Address-Based and Name-Based Virtual Hosts; 4.6 Mass Virtual Hosting with mod_vhost_alias virtual hosts mass mod_vhost_alias and virtual hosts mod_vhost_alias mod_vhost_alias; 4.7 Mass Virtual Hosting Using Rewrite Rules; 4.8 Logging for Each logs virtual hosts virtual hosts logging for Virtual Host; 4.9 logfiles splitting virtual hosts logfiles, splitting Splitting Up a Logfile; 4.10 port-based virtual hosts virtual hosts port-based Port-Based Virtual Hosts; 4.11 addresses, displaying same content on multiple Displaying the Same Content on Several Addresses; 4.12 Defining databases virtual hosts virtual hosts defining in database Virtual Hosts in a Database; Chapter 5: Aliases, Redirecting, and Rewriting; 5.1 directories URLs mapping mapping, URLs, to directories URLs (Uniform Resource Locators) mapping to directories Mapping a URL to a Directory; 5.2 Creating a URLs (Uniform Resource Locators) new, creating for existing content New URL for Existing Content; 5.3 Giving URLs (Uniform Resource Locators) users having own URLs Users Their Own URLs; 5.4 URLs (Uniform Resource Locators) aliasing, one directive Aliasing Several aliases URLs, several with one directive URLs with a Single Directive; 5.5 directories URLs mapping to same CGI directory Mapping Several URLs to the URLs (Uniform Resource Locators) mapping to directories same CGI directory Same CGI Directory; 5.6 CGI directories creating for each user directories CGI creating for each user Creating a CGI Directory for Each User; 5.7 Redirecting redirecting URLs to another location to Another Location; 5.8 Redirecting Several URLs to the redirecting URLs to same destination Same Destination; 5.9 Permitting case-insensitive URLs URLs (Uniform Resource Locators) case-insensitive Case-Insensitive URLs; 5.10 Showing PHP source, highlighted without symlinking symlinking, highlighted PHP source without Highlighted PHP Source without Symlinking; 5.11 URLs (Uniform Resource Locators) replacing text in requested Replacing Text in Requested URLs; 5.12 CGI arguments, rewriting path information Rewriting rewriting path information to CGI arguments Path Information to CGI Arguments; 5.13 requests unreferred denying access to unreferred requests denying access to Denying Access to Unreferred Requests; 5.14 requests unreferred redirecting to explanation page unreferred requests redirecting to explanation page Redirecting redirecting unreferred requests to explanation page Unreferred Requests to an Explanation Page; 5.15 query strings, rewriting based on Rewriting rewriting based on query string Based on the Query String; 5.16 SSL (Secure Socket Layers) redirecting to Redirecting All--or Part--of Your Server redirecting to SSL to SSL; 5.17 directories turning into hostnames hostnames turning directories into Turning Directories into Hostnames; 5.18 requests redirecting to single host Redirecting All redirecting requests to single host Requests to a Single Host; 5.19 arguments, turning document names into documents names, turning into arguments Turning Document Names into Arguments; 5.20 URLs (Uniform Resource Locators) elements, rewriting between path and query string Rewriting rewriting URL elements between path and query string Elements between Path and Query String; 5.21 directories rewriting hostnames to hostnames rewriting to directory Rewriting a rewriting hostnames to directories Hostname to a Directory; 5.22 query arguments, turning URL segments into URLs (Uniform Resource Locators) segments, turning into query arguments Turning URL Segments into Query Arguments; 5.23 Using AliasMatch AliasMatch, ScriptAliasMatch ScriptAliasMatch, and RedirectMatch RedirectMatch; Chapter 6: Security; 6.1 Using authentication system account information and security authentication system account information and System Account Information for Web Authentication; 6.2 Setting Up passwords single-use security passwords single-use single-use passwords Single-Use Passwords; 6.3 expiring passwords passwords expiring security passwords expiring Expiring Passwords; 6.4 uploads, size, limiting Limiting Upload Size; 6.5 images, restricting off-site use off-site use of images, restricting Restricting Images from Being Used Off-Site; 6.6 authentication strong, requiring security authentication requiring weak and strong Requiring Both authentication weak, requiring weak authentication, requiring Weak and strong authentication, requiring Strong Authentication; 6.7 Managing .htpasswd files passwords .htpasswd files security passwords .htpasswd files .htpasswd Files; 6.8 Making authentication digest authentication password files and digest authentication password files and Password Files for passwords digest authentication and Digest Authentication; 6.9 directories subdirectories, relaxing security in security relaxing in subdirectories subdirectories, relaxing security in Relaxing Security in a Subdirectory; 6.10 security lifting restrictions selectively Lifting Restrictions Selectively; 6.11 files ownership, authorizing ownerhips of files, authorizing security file ownership, authorizing Authorizing Using File Ownership; 6.12 Storing MySQL user credentials security user credentials, MySQL databases User Credentials in a MySQL Database; 6.13 authentication usernames, accessing security authentication username access usernames, authenticated, accessing Accessing the Authenticated Username; 6.14 authentication passwords, obtaining passwords obtaining security passwords obtaining Obtaining the Password Used to Authenticate; 6.15 brute-force password attacks, preventing passwords brute-force attacks, preventing security passwords preventing brute-force attacks Preventing Brute-Force Password Attacks; 6.16 Using security authentication digest authentication Digest authentication digest authentication versus basic digest authentication versus basic Versus Basic Authentication; 6.17 credentials, accessing, embedded in URLs Accessing security credentials embedded in URLs URLs (Uniform Resource Locators) credentials embedded in Credentials Embedded in URLs; 6.18 Securing security WebDAV WebDAV security WebDAV; 6.19 WebDAV enabling, writable files and Enabling WebDAV Without Making Files Writable by the Web User; 6.20 proxies URL access, restricting Restricting URLs (Uniform Resource Locators) proxy access, restricting Proxy Access to Certain URLs; 6.21 Protecting Files with a files wrappers security wrappers wrappers Wrapper; 6.22 Protecting files servers, malicious scripts and security server files, protecting servers files, malicious scripts and Server Files from Malicious Scripts; 6.23 files permissions, setting permissions, setting security file permissions, setting Setting Correct File Permissions; 6.24 module sets, running minimal security module sets, running minimal Running a Minimal Module Set; 6.25 files outside Web root, restricting access security files, outside Web root, restricting access Restricting Access to Files Outside Your Web Root; 6.26 methods, limiting security methods, limiting Limiting Methods by User; 6.27 range requests, restricting security range requests, restricting Restricting Range Requests; 6.28 Rebutting DoS attacks, mod_evasive and mod_evasive, DoS attacks and security DoS attacks, mod_evasive and DoS Attacks with mod_evasive; 6.29 chroot, mod_security and mod_security chroot and security mod_security, chroot and Chrooting Apache with mod_security; 6.30 authentication migrating to 2.2 security authentication migrating to 2.2 Migrating to 2.2 Authentication; 6.31 Blocking mod_security worms and security worms, mod_security and worms, mod_security and Worms with mod_security; 6.32 Mixing read-only access, Subversion repository and Subversion read-only access Read-Only and Subversion write access write access, Subversion repository and Write Access to a Subversion Repository; 6.33 Using redirecting permanent, forbidden URLs and URLs (Uniform Resource Locators) forbidden, permanent redirects Permanent Redirects to Obscure Forbidden URLs; Chapter 7: SSL; 7.1 SSL (Secure Socket Layers) installation Installing SSL; 7.2 Windows SSL installation Installing SSL installation SSL on Windows SSL (Secure Socket Layers) installation on Windows on Windows; 7.3 Generating self-signed SSL certificates SSL (Secure Socket Layers) certificates self-signed Self-Signed SSL Certificates; 7.4 SSL (Secure Socket Layers) CAs, trusted, generating Generating a Trusted CAs (Certificate Authorities), trusted, generating CA; 7.5 Serving a SSL (Secure Socket Layers) portion of site available via Portion of Your Site via SSL; 7.6 Authenticating with Client authentication SSL, certificates SSL (Secure Socket Layers) certificates authentication and Certificates; 7.7 virtual hosts SSL SSL SSL (Secure Socket Layers) virtual hosts Virtual Hosts; 7.8 SSL (Secure Socket Layers) certificates wild card wild card certificates Wildcard Certificates; Chapter 8: Dynamic Content; 8.1 Enabling a CGI Directory; 8.2 CGI scripts enabling, non-ScriptAliased directories Enabling CGI Scripts in Non-ScriptAliased Directories; 8.3 CGI directories default documents, specifying documents CGI directories, specifying Specifying a Default Document in a CGI Directory; 8.4 Using CGI programs launching, Windows file extensions Windows File Extensions to Windows CGI programs, launching Launch CGI Programs; 8.5 Using CGI scripts extensions Extensions to Identify CGI Scripts; 8.6 CGI testing setup Testing that CGI Is Set Up Correctly; 8.7 CGI form parameters, reading Reading Form Parameters; 8.8 CGI invoking for certain content types Invoking a CGI Program for Certain Content Types; 8.9 Getting SSIs (Server-Side Includes) SSIs to Work; 8.10 Displaying date, last modified last modified date Last Modified Date; 8.11 Including a Standard Header; 8.12 Including the CGI program output Output of a CGI Program; 8.13 CGI scripts running as different user, suexec and Running CGI Scripts as a Different User with suexec; 8.14 CPAN, installing mod_perl handler mod_perl handler installing from CPAN Installing a mod_perl Handler from CPAN; 8.15 mod_perl handler writing Writing a mod_perl Handler; 8.16 PHP script handling, enabling Enabling PHP Script Handling; 8.17 PHP installation, verifying Verifying PHP Installation; 8.18 CGI parsing output, SSIs and SSIs (Server-Side Includes) parsing CGI output for Parsing CGI Output for Server Side Includes; 8.19 Parsing SSIs (Server-Side Includes) ScriptAlias output ScriptAlias Script ScriptAlias output, parsing for SSIs Output for Server-Side Includes; 8.20 Getting Perl scripts, mod_perl and mod_perl to Handle All mod_perl Perl scripts and Perl Scripts; 8.21 Python, enabling script handling Enabling Python Script Handling; Chapter 9: Error Handling; 9.1 Handling a error handling host fields, missing host fields, missing Missing Host Field; 9.2 Changing the CGI scripts response status error handling CGI scripts, response status Response Status for CGI Scripts; 9.3 error handling error messages, customized error messages, customized Customized Error Messages; 9.4 Providing documents error documents, multiple languages error documents, multiple languages Error Documents in Multiple Languages; 9.5 error handling redirecting, invalid URLs URLs (Uniform Resource Locators) redirecting invalid Redirecting Invalid URLs to Some Other Page; 9.6 Making error handling displaying error page, Internet Explorer and Internet Explorer, displaying error page Internet Explorer Display Your Error Page; 9.7 error handling notification on error conditions Notification on Error Conditions; Chapter 10: Proxies; 10.1 proxies server securing servers proxy securing Securing Your Proxy Server; 10.2 servers proxy preventing use as open mail relay proxies server preventing use as open mail relay Preventing Your Proxy Server from Being Used as an Open Mail Relay; 10.3 servers requests, forwarding to another server Forwarding Requests to Another Server; 10.4 proxies server blocking requests to certain places servers proxy blocking requests to certain places Blocking Proxied Requests to Certain Places; 10.5 mod_perl proxying content to another server proxies mod_perl content to another server Proxying mod_perl Content to Another Server; 10.6 caching proxy servers, configuring proxies server caching, configuring servers proxy caching, configuring Configuring a Caching Proxy Server; 10.7 filters, proxied content proxies filtering proxied content Filtering Proxied Content; 10.8 Requiring proxies servers, authentication servers proxy authentication Authentication for a authentication proxy servers security authentication proxy servers Proxied Server; 10.9 proxies mod_proxy_balancer, load balancing and Load mod_proxy_balancer, load balancing and Balancing with load balancing mod_proxy_balancer and mod_proxy_balancer; 10.10 Proxied proxies virtual hosts and virtual hosts proxies and Virtual Host; 10.11 FTP, refusing to proxy proxies FTP, refusing to proxy Refusing to Proxy FTP; Chapter 11: Performance; 11.1 memory, determining need Determining How Much Memory You Need; 11.2 ab, benchmarking and benchmarking, ab and Benchmarking Apache with ab; 11.3 Tuning KeepAlive settings KeepAlive Settings; 11.4 Getting a Snapshot of Your Site's Activity; 11.5 DNS lookups, avoiding Avoiding DNS Lookups; 11.6 symbolic links, optimizing Optimizing links, symbolic, avoiding Symbolic Links; 11.7 Minimizing the Performance Impact of .htaccess files .htaccess Files; 11.8 content negotiation, disabling Disabling Content Negotiation; 11.9 process creation, optimizing Optimizing Process Creation; 11.10 Tuning thread creation Thread Creation; 11.11 files frequently viewed, caching frequently viewed files, caching Caching Frequently Viewed Files; 11.12 load balancing distributing evenly between servers servers load, evenly distributing Distributing Load Evenly Between Several Servers; 11.13 directories caching Caching Directory Listings; 11.14 Speeding Up Perl mod_perl CGI programs and Perl CGI programs, mod_perl and CGI Programs with CGI programs mod_perl and mod_perl; 11.15 dynamic content, caching Caching Dynamic Content; Chapter 12: Directory Listings; 12.1 directories generating folders, listings, generating Generating Directory/Folder Listings; 12.2 Display a Standard directories headers/footers Header and Footer on Directory Listings; 12.3 stylesheets, applying Applying a Stylesheet; 12.4 directories hiding items Hiding Things from the Listing; 12.5 directories files searching for Searching for Certain Files in a Directory Listing; 12.6 directories sorting Sorting the List; 12.7 Allowing a directories client-specified sort order Client-Specified Sort Order; 12.8 Specifying How the List Will Be directories formatting Formatted; 12.9 Allowing the directories client-specified formatting Client to Specify the Formatting; 12.10 Adding directories files descriptions files descriptions Descriptions to Files; 12.11 directories document titles, autogenerated documents titles, autogenerated Autogenerated Document Titles; 12.12 Changing the icons, directory listings Listing directories icons Icons; 12.13 Listing the Directories First; 12.14 Ordering by directories files version number directories files version number sorting files version number listing Version Number; 12.15 Allowing the End User to Specify Version Sorting; 12.16 Complete directories user control of output User Control of Output; 12.17 Don't Allow the directories end-user modification End User to Modify the Listing; 12.18 directories column suppression Suppressing Certain Columns; 12.19 Showing Forbidden Files; 12.20 directories aliases in Aliases in Directory Listings; Chapter 13: Miscellaneous Topics; 13.1 directives, placement of Placing Directives Properly; 13.2 .htaccess files renaming Renaming .htaccess Files; 13.3 directories generating folders, listings, generating Generating Directory/Folder Listings; 13.4 slashes, trailing in URLs Solving the trailing slashes in URLs URLs (Uniform Resource Locators) trailing slashes "Trailing Slash" Problem; 13.5 Setting the Content-Type headers Content-Type According to Browser Capability; 13.6 Handling Missing Host: header field Host: Header Fields; 13.7 documents default, alternate Alternate Default Document; 13.8 favicon, default Setting Up a Default "Favicon"; 13.9 Directory Listings in ScriptAliased Directories; 13.10 .htaccess files enabling Enabling .htaccess Files; 13.11 Converting SSIs (Server-Side Includes) IBM/Lotus, converting to Apache IBM/Lotus Server-Side Includes to Apache; Using Regular Expressions in Apache; What Directives Use regular expressions vocabulary Regular Expressions?; Troubleshooting; Troubleshooting Methodology; Debugging the troubleshooting debugging configuration Configuration; Debugging troubleshooting debugging premature end of script headers Premature End of Script Headers; Common Problems on Windows; Fixing troubleshooting error messages, build-time Build-Time Error Messages; Getting Server-Side Includes to Work; Debugging Rewrites That Result in troubleshooting Not Found errors "Not Found" Errors; troubleshooting .htaccess files .htaccess Files Having No Effect; troubleshooting address already in use Address Already in Use; Colophon;