You are previewing Apache: The Definitive Guide, 3rd Edition.
O'Reilly logo
Apache: The Definitive Guide, 3rd Edition

Book Description

Apache is far and away the most widely used web server platform in the world. This versatile server runs more than half of the world's existing web sites. Apache is both free and rock-solid, running more than 21 million web sites ranging from huge e-commerce operations to corporate intranets and smaller hobby sites. With this new third edition of Apache: The Definitive Guide, web administrators new to Apache will come up to speed quickly, and experienced administrators will find the logically organized, concise reference sections indispensable, and system programmers interested in customizing their servers will rely on the chapters on the API and Apache modules. Updated to cover the changes in Apache's latest release, 2.0, as well as Apache 1.3, this useful guide discusses how to obtain, set up, secure, modify, and troubleshoot the Apache software on both Unix and Windows systems. Dozens of clearly written examples provide the answers to the real-world issues that Apache administrators face everyday. In addition to covering the installation and configuration of mod_perl and Tomcat, the book examines PHP, Cocoon, and other new technologies that are associated with the Apache web server. Additional coverage of security and the Apache 2.0 API make Apache: The Definitive Guide, Third Edition essential documentation for the world's most popular web server.

Table of Contents

  1. Apache: The Definitive Guide, 3rd Edition
  2. A Note Regarding Supplemental Files
  3. Preface
    1. Who Wrote Apache, and Why?
    2. The Demonstration Code
    3. Conventions Used in This Book
      1. Typographic Conventions
      2. Icons
      3. Pathnames
      4. Directives
        1. Directive
        2. ServerAdmin
    4. Organization of This Book
    5. Acknowledgments
  4. 1. Getting Started
    1. 1.1. What Does a Web Server Do?
      1. 1.1.1. Criteria for Choosing a Web Server
      2. 1.1.2. Why Apache?
    2. 1.2. How Apache Works
    3. 1.3. Apache and Networking
      1. 1.3.1. What to Know About TCP/IP
      2. 1.3.2. How Apache Uses TCP/IP
      3. 1.3.3. Apache and Domain Name Servers
        1. 1.3.3.1. Multiple sites: Unix
        2. 1.3.3.2. Multiple sites: Win32
    4. 1.4. How HTTP Clients Work
    5. 1.5. What Happens at the Server End?
    6. 1.6. Planning the Apache Installation
      1. 1.6.1. Fitting Apache into Your Network
      2. 1.6.2. Which Operating System?
      3. 1.6.3. Which Unix?
    7. 1.7. Windows?
    8. 1.8. Which Apache?
      1. 1.8.1. Apache 2.0
      2. 1.8.2. Apache 2.0 and Win32
    9. 1.9. Installing Apache
      1. 1.9.1. Apache Executables for Unix
      2. 1.9.2. Making Apache 1.3.X Under Unix
      3. 1.9.3. Modules Under Unix
        1. 1.9.3.1. Compiled in modules
        2. 1.9.3.2. DSO modules
        3. 1.9.3.3. APXS
    10. 1.10. Building Apache 1.3.X Under Unix
      1. 1.10.1. Out of the Box
      2. 1.10.2. Semimanual Build Method
      3. 1.10.3. Choosing Modules
      4. 1.10.4. Shared Objects
      5. 1.10.5. Configuration Settings and Rules
      6. 1.10.6. Making Apache
    11. 1.11. New Features in Apache v2
      1. 1.11.1. Config File Changes in v2
      2. 1.11.2. httpd Command-Line Changes
      3. 1.11.3. Module Changes in v2
    12. 1.12. Making and Installing Apache v2 Under Unix
    13. 1.13. Apache Under Windows
      1. 1.13.1. Modules Under Windows
      2. 1.13.2. Compiling Apache Under Win32
  5. 2. Configuring Apache: The First Steps
    1. 2.1. What's Behind an Apache Web Site?
      1. 2.1.1. Running Apache from the Command Line
    2. 2.2. site.toddle
    3. 2.3. Setting Up a Unix Server
      1. 2.3.1. webuser and webgroup
        1. 2.3.1.1. User
        2. 2.3.1.2. Group
      2. 2.3.2. "Out of the Box" Default Problems
      3. 2.3.3. Running Apache Under Unix
      4. 2.3.4. Several Copies of Apache
      5. 2.3.5. Unix Permissions
      6. 2.3.6. A Local Network
    4. 2.4. Setting Up a Win32 Server
      1. 2.4.1. Console Window
      2. 2.4.2. Apache as a Service
    5. 2.5. Directives
      1. 2.5.1. ServerName
      2. 2.5.2. DocumentRoot
      3. 2.5.3. ServerRoot
      4. 2.5.4. ErrorLog
      5. 2.5.5. PidFile
      6. 2.5.6. TypesConfig
      7. 2.5.7. Inclusions into the Config file
    6. 2.6. Shared Objects
      1. 2.6.1. Shared Objects Under Unix
        1. 2.6.1.1. LoadModule
      2. 2.6.2. Shared Modules Under Win32
        1. 2.6.2.1. LoadFile
        2. 2.6.2.2. ClearModuleList
        3. 2.6.2.3. AddModule
  6. 3. Toward a Real Web Site
    1. 3.1. More and Better Web Sites: site.simple
      1. 3.1.1. ErrorDocument
    2. 3.2. Butterthlies, Inc., Gets Going
      1. 3.2.1. Default Index
      2. 3.2.2. index.html
    3. 3.3. Block Directives
      1. <VirtualHost>
      2. <Directory> and <DirectoryMatch>
      3. <Files> and <FilesMatch>
      4. <Location> and <LocationMatch>
      5. <IfDefine>
      6. <IfModule>
    4. 3.4. Other Directives
      1. ServerName
      2. UseCanonicalName
      3. ServerAdmin
      4. ServerSignature
      5. ServerTokens
      6. ServerAlias
      7. ServerPath
      8. ScoreBoardFile
      9. CoreDumpDirectory
      10. SendBufferSize
      11. LockFile
      12. AcceptMutex
      13. KeepAlive
      14. KeepAliveTimeout
      15. TimeOut
      16. HostNameLookups
      17. Include
      18. Limit
      19. <LimitExcept>
      20. LimitRequestBody Directive
      21. LimitRequestFields
      22. LimitRequestFieldsize
      23. LimitRequestLine
    5. 3.5. HTTP Response Headers
      1. Reference Section
        1. HeaderName
      2. Reference Section
        1. Header
      3. Reference Section
        1. Header
      4. Reference Section
        1. Options
      5. 3.5.1. FollowSymLinks, SymLinksIfOwnerMatch
    6. 3.6. Restarts
    7. 3.7. .htaccess
    8. 3.8. CERN Metafiles
      1. MetaFiles
      2. MetaDir
      3. MetaSuffix
    9. 3.9. Expirations
      1. ExpiresActive
      2. ExpiresByType
      3. ExpiresDefault
  7. 4. Virtual Hosts
    1. 4.1. Two Sites and Apache
    2. 4.2. Virtual Hosts
      1. 4.2.1. Name-Based Virtual Hosts
        1. 4.2.1.1. NameVirtual host
      2. 4.2.2. IP-Based Virtual Hosts
      3. 4.2.3. Mixed Name/IP-Based Virtual Hosts
      4. 4.2.4. Port-Based Virtual Hosting
    3. 4.3. Two Copies of Apache
      1. BindAddress
      2. Port
      3. Listen
      4. ListenBacklog
      5. ServerType
    4. 4.4. Dynamically Configured Virtual Hosting
      1. 4.4.1. Examples
        1. VirtualDocumentRoot
        2. VirtualDocumentRootIP
        3. VirtualScriptAlias
        4. VirtualScriptAliasIP
  8. 5. Authentication
    1. 5.1. Authentication Protocol
      1. 5.1.1. site.authent
    2. 5.2. Authentication Directives
      1. AuthType
      2. AuthName
      3. AuthGroupFile
      4. AuthUserFile
      5. AuthAuthoritative
      6. AuthDBAuthoritative
      7. AuthDBMAuthoritative
      8. require
      9. satisfy
    3. 5.3. Passwords Under Unix
    4. 5.4. Passwords Under Win32
    5. 5.5. Passwords over the Web
    6. 5.6. From the Client's Point of View
      1. 5.6.1. The Config File
    7. 5.7. CGI Scripts
    8. 5.8. Variations on a Theme
    9. 5.9. Order, Allow, and Deny
      1. allow from
      2. allow from env
      3. deny from
      4. deny from env
      5. Order
    10. 5.10. DBM Files on Unix
      1. 5.10.1. AuthDBUserFile
        1. 5.10.1.1. Security
      2. 5.10.2. AuthDBMUserFile
        1. 5.10.2.1. Security
    11. 5.11. Digest Authentication
      1. 5.11.1. ContentDigest
    12. 5.12. Anonymous Access
      1. Anonymous
      2. Anonymous_NoUserID
      3. Anonymous_LogEmail
      4. Anonymous_VerifyEmail
      5. Anonymous_Authoritative
      6. Anonymous_MustGiveEmail
    13. 5.13. Experiments
      1. 5.13.1. Access.conf
    14. 5.14. Automatic User Information
      1. 5.14.1. IdentityCheck
    15. 5.15. Using .htaccess Files
      1. 5.15.1. AccessFileName
    16. 5.16. Overrides
      1. 5.16.1. AllowOverride
  9. 6. Content Description and Modification
    1. 6.1. MIME Types
      1. TypesConfig
      2. AddType
      3. DefaultType
      4. ForceType
      5. RemoveType
      6. AddEncoding
      7. RemoveEncoding
      8. AddDefaultCharset
      9. AddCharset
      10. RemoveCharset Directive
      11. AddHandler
      12. SetHandler
      13. RemoveHandler Directive
      14. AcceptFilter
    2. 6.2. Content Negotiation
      1. 6.2.1. MultiviewsMatch
      2. 6.2.2. Image Negotiation
    3. 6.3. Language Negotiation
      1. LanguagePriority
      2. AddLanguage
      3. DefaultLanguage
      4. RemoveLanguage
    4. 6.4. Type Maps
    5. 6.5. Browsers and HTTP 1.1
    6. 6.6. Filters
      1. AddInputFilter
      2. AddOutputFilter
      3. SetInputFilter
      4. SetOutputFilter
      5. RemoveInputFilter
      6. RemoveOutputFilter
  10. 7. Indexing
    1. 7.1. Making Better Indexes in Apache
      1. IndexOptions
      2. IndexOrderDefault
      3. ReadmeName
      4. FancyIndexing
      5. IndexIgnore
      6. AddIcon
      7. AddAlt
      8. AddDescription
      9. DefaultIcon
      10. AddIconByType
      11. AddAltByType
      12. AddIconByEncoding
      13. AddAltByEncoding
      14. HeaderName
    2. 7.2. Making Our Own Indexes
      1. 7.2.1. DirectoryIndex
    3. 7.3. Imagemaps
      1. 7.3.1. HTML File
      2. 7.3.2. Map File
    4. 7.4. Image Map Directives
      1. ImapBase
      2. ImapMenu
      3. ImapDefault
  11. 8. Redirection
    1. 8.1. Alias
      1. 8.1.1. A Subtle Problem
        1. Script
        2. ScriptAlias
        3. ScriptAliasMatch
        4. ScriptInterpreterSource
        5. Alias
        6. AliasMatch
        7. UserDir
        8. Redirect
        9. RedirectMatch
        10. RedirectTemp
        11. RedirectPermanent
    2. 8.2. Rewrite
      1. Reference Section
        1. RewriteEngine
      2. Reference Section
        1. RewriteLog
      3. Reference Section
        1. RewriteLogLevel
      4. Reference Section
        1. RewriteMap
      5. Reference Section
        1. RewriteBase
      6. Reference Section
        1. RewriteCond
      7. Reference Section
        1. RewriteLock
      8. Reference Section
        1. RewriteOptions
      9. Reference Section
        1. RewriteRule
      10. 8.2.1. A Rewrite Example
    3. 8.3. Speling
      1. 8.3.1. CheckSpelling
  12. 9. Proxying
    1. 9.1. Security
    2. 9.2. Proxy Directives
      1. AllowCONNECT
      2. ProxyRequests
      3. ProxyRemote
      4. ProxyPass
      5. ProxyDomain
      6. NoProxy
      7. ProxyPassReverse
      8. ProxyVia
      9. ProxyReceiveBufferSize
      10. ProxyBlock
    3. 9.3. Apparent Bug
    4. 9.4. Performance
      1. 9.4.1. Inward Caching
        1. CacheRoot
        2. CacheSize
        3. CacheGcInterval
        4. CacheMaxExpire
        5. CacheLastModifiedFactor
        6. CacheDefaultExpire
        7. CacheDirLevels and CacheDirLength
        8. CacheNegotiatedDocs
        9. NoCache
    5. 9.5. Setup
      1. 9.5.1. Reverse Proxy
  13. 10. Logging
    1. 10.1. Logging by Script and Database
    2. 10.2. Apache's Logging Facilities
      1. Reference Section
        1. ErrorLog
      2. Reference Section
        1. TransferLog
      3. Reference Section
        1. AgentLog
      4. Reference Section
        1. LogLevel
      5. Reference Section
        1. LogFormat
      6. Reference Section
        1. CustomLog
      7. 10.2.1. site.authent — Another Example
    3. 10.3. Configuration Logging
      1. 10.3.1. AddModuleInfo
    4. 10.4. Status
      1. 10.4.1. Server Status
      2. 10.4.2. ExtendedStatus
  14. 11. Security
    1. 11.1. Internal and External Users
    2. 11.2. Binary Signatures, Virtual Cash
    3. 11.3. Certificates
    4. 11.4. Firewalls
      1. 11.4.1. Packet Filtering
      2. 11.4.2. Separate Networks
        1. 11.4.2.1. Advantages
        2. 11.4.2.2. Disadvantages
    5. 11.5. Legal Issues
    6. 11.6. Secure Sockets Layer (SSL)
    7. 11.7. Apache's Security Precautions
      1. 11.7.1. SSL with Apache v1.3
        1. 11.7.1.1. Apache-SSL
        2. 11.7.1.2. OpenSSL
        3. 11.7.1.3. Rebuild Apache
        4. 11.7.1.4. Config file
        5. 11.7.1.5. Environment variables
      2. 11.7.2. mod_ssl with Apache 1.3
      3. 11.7.3. SSL with Apache v2
        1. 11.7.3.1. Config file
        2. 11.7.3.2. Environment variables
      4. 11.7.4. Make a Test Certificate
      5. 11.7.5. Getting a Server Certificate
      6. 11.7.6. The Global Session Cache
    8. 11.8. SSL Directives
      1. 11.8.1. Apache-SSL Directives for Apache v1.3
        1. SSLDisable
        2. SSLEnable
        3. SSLRequireSSL
        4. SSLDenySSL
        5. SSLCacheServerPath
        6. SSLCacheServerRunDir
        7. SSLCacheServerPort
        8. SSLSessionCacheTimeout
        9. SSLCACertificatePath
        10. SSLCACertificateFile
        11. SSLCertificateFile
        12. SSLCertificateKeyFile
        13. SSLVerifyClient
        14. SSLVerifyDepth
        15. SSLFakeBasicAuth
        16. SSLNoCAList
        17. SSLRandomFile
        18. SSLRandomFilePerConnection
        19. CustomLog
        20. SLLExportClientCertificates
      2. 11.8.2. SSL Directives for Apache v2
        1. SSLPassPhraseDialog
        2. SSLMutex
        3. SSLRandomSeed
        4. SSLSessionCache
        5. SSLEngine
        6. SSLProtocol
        7. SSLCertificateFile
        8. SSLCertificateKeyFile
        9. SSLCertificateChainFile
        10. SSLCACertificatePath
        11. SSLCACertificateFile
        12. SSL CAR evocation path
        13. SSL CAR evocation file
        14. SSLVerifyClient
        15. SSLVerifyDepth
        16. Slog
        17. SSLLogLevel
        18. SSLOptions
        19. SSLRequireSSL
        20. SSLRequire
    9. 11.9. Cipher Suites
      1. 11.9.1. Cipher Directives for Apache v1.3
        1. SSLRequiredCiphers
        2. SSLRequireCipher
        3. SSLCheckClientDN
        4. SSLBanCipher
      2. 11.9.2. Cipher Directives for Apache v2
        1. SSLCipherSuite
    10. 11.10. Security in Real Life
      1. 11.10.1. Cookbook Security
      2. 11.10.2. Demo Client Certificate
      3. 11.10.3. Get the CA Certificate
    11. 11.11. Future Directions
      1. 11.11.1. SE Linux
      2. 11.11.2. EROS
      3. 11.11.3. E
  15. 12. Running a Big Web Site
    1. 12.1. Machine Setup
    2. 12.2. Server Security
      1. 12.2.1. Root Password
      2. 12.2.2. File Positions and Ownerships
      3. 12.2.3. The Apache Web Site
        1. 12.2.3.1. Permissions on ServerRoot directories
        2. 12.2.3.2. Server-side includes
        3. 12.2.3.3. Nonscript-aliased CGI
        4. 12.2.3.4. Script-aliased CGI
        5. 12.2.3.5. CGI in general
        6. 12.2.3.6. Stopping users overriding system-wide settings...
        7. 12.2.3.7. Protect server files by default
    3. 12.3. Managing a Big Site
      1. 12.3.1. Development Machines
      2. 12.3.2. Beta Test
      3. 12.3.3. The Live Site
      4. 12.3.4. Upgrade Procedures
      5. 12.3.5. Maintenance Pages
    4. 12.4. Supporting Software
      1. 12.4.1. Database Manager
      2. 12.4.2. Mailserver
      3. 12.4.3. PGP
      4. 12.4.4. SSH Access to Server
      5. 12.4.5. Credit Cards
      6. 12.4.6. Passwords
      7. 12.4.7. Turn Off Unwanted Services
      8. 12.4.8. Backend Networks
      9. 12.4.9. SuEXEC
      10. 12.4.10. SSL
      11. 12.4.11. Certificates
    5. 12.5. Scalability
      1. 12.5.1. Performance
        1. 12.5.1.1. Tools
        2. 12.5.1.2. Apache's mod_info
        3. 12.5.1.3. Bandwidth
        4. 12.5.1.4. Load balancing
        5. 12.5.1.5. Image server, text server
      2. 12.5.2. Shared Versus Replicated DBs
    6. 12.6. Load Balancing
      1. 12.6.1. Spreading the Load
      2. 12.6.2. mod_backhand
      3. 12.6.3. Installation of mod_backhand
      4. 12.6.4. Directives
        1. Backhand
        2. BackhandFromSO
        3. UnixSocketDir
        4. MulticastStats
        5. AcceptStats
        6. HTTPRedirectToIP
        7. HTTPRedirectToName
        8. BackhandSelfRedirect
        9. BackhandLogLevel
        10. BackhandModeratorPIDFile
      5. 12.6.5. Candidacy Functions
        1. byAge
        2. byLoad
        3. byBusyChildren
        4. byCPU
        5. byLogWindow
        6. byRandom
        7. byCost
        8. bySession
        9. addPrediction
        10. byHostname
      6. 12.6.6. The Config File
      7. 12.6.7. Example Site
  16. 13. Building Applications
    1. 13.1. Web Sites as Applications
      1. 13.1.1. A Closer Look at HTTP
      2. 13.1.2. Creating a Form
      3. 13.1.3. Other Approaches to Application Building
    2. 13.2. Providing Application Logic
      1. 13.2.1. Server-Side Includes
      2. 13.2.2. PHP
      3. 13.2.3. Perl
      4. 13.2.4. Java
      5. 13.2.5. Other Options
    3. 13.3. XML, XSLT, and Web Applications
  17. 14. Server-Side Includes
    1. 14.1. File Size
    2. 14.2. File Modification Time
    3. 14.3. Includes
    4. 14.4. Execute CGI
    5. 14.5. Echo
    6. 14.6. Apache v2: SSI Filters
      1. SSIEndTag
      2. SSIErrorMsg
      3. SSIStartTag
      4. SSITimeFormat
      5. SSIUndefinedEcho
      6. XBitHack
      7. XSSI
  18. 15. PHP
    1. 15.1. Installing PHP
    2. 15.2. Site.php
      1. 15.2.1. Errors
      2. 15.2.2. Standalone PHP Scripts
  19. 16. CGI and Perl
    1. 16.1. The World of CGI
      1. 16.1.1. Writing and Executing Scripts
      2. 16.1.2. Scripts and Apache
        1. 16.1.2.1. Executable script
    2. 16.2. Telling Apache About the Script
      1. 16.2.1. Script in cgi-bin
      2. 16.2.2. Script in DocumentRoot
      3. 16.2.3. Perl
      4. 16.2.4. Databases
      5. 16.2.5. HTML
      6. 16.2.6. Running a Script via Apache
      7. 16.2.7. Quote Marks
      8. 16.2.8. HTTP Header
      9. 16.2.9. Getting Data from the Client
        1. 16.2.9.1. Data from a link
        2. 16.2.9.2. CGI.pm
        3. 16.2.9.3. Questions and answers
      10. 16.2.10. Environment Variables
    3. 16.3. Setting Environment Variables
      1. SetEnv
      2. UnsetEnv
      3. PassEnv
    4. 16.4. Cookies
      1. 16.4.1. Apache Cookies
        1. CookieName
        2. CookieLog
        3. CookieTracking
      2. 16.4.2. The Config File
      3. 16.4.3. Email
      4. 16.4.4. Search Engines and CGI
      5. 16.4.5. Debugging
      6. 16.4.6. Debuggers
      7. 16.4.7. Security
    5. 16.5. Script Directives
      1. ScriptAlias
      2. ScriptAliasMatch
      3. ScriptLog
      4. ScriptLogLength
      5. ScriptLogBuffer
      6. RLimitCPU
      7. RLimitMEM
      8. RLimitNPROC
    6. 16.6. suEXEC on Unix
      1. 16.6.1. A Demonstration of suEXEC
    7. 16.7. Handlers
      1. AddHandler
      2. SetHandler
      3. RemoveHandler
    8. 16.8. Actions
      1. 16.8.1. Action
    9. 16.9. Browsers
      1. SetEnvIf and SetEnvIfNoCase
      2. BrowserMatch and BrowserMatchNoCase
      3. nokeepalive
      4. force-response-1.0
      5. downgrade-1.0
  20. 17. mod_perl
    1. 17.1. How mod_perl Works
    2. 17.2. mod_perl Documentation
    3. 17.3. Installing mod_perl — The Simple Way
      1. 17.3.1. Linking More Than One Module
      2. 17.3.2. Test
      3. 17.3.3. Installation Gotchas
    4. 17.4. Modifying Your Scripts to Run Under mod_perl
    5. 17.5. Global Variables
      1. 17.5.1. Perl Flags
    6. 17.6. Strict Pregame
    7. 17.7. Loading Changes
    8. 17.8. Opening and Closing Files
    9. 17.9. Configuring Apache to Use mod_perl
      1. 17.9.1. Performance Tuning
      2. 17.9.2. Making Scripts Run Faster
        1. 17.9.2.1. Preloading modules and compiling
        2. 17.9.2.2. Database interface persistence
        3. 17.9.2.3. KeepAlives and MaxClients
        4. 17.9.2.4. Profiling
  21. 18. mod_jserv and Tomcat
    1. 18.1. mod_jserv
      1. 18.1.1. Making gmake
      2. 18.1.2. Building JServ
      3. 18.1.3. JServ Directives
        1. ApJservManual
        2. ApJServProperties
        3. ApJServLogFile
        4. ApJServLogFile
        5. ApJServDefaultProtocol
        6. ApJServDefaultHost
        7. ApJServDefaultPort
        8. ApJServVMTimeout
        9. ApJServProtocolParameter
        10. ApJServSecretKey
        11. ApJServMount
        12. ApJServMountCopy
        13. ApJServAction
      4. 18.1.4. JServ Status
      5. 18.1.5. Writing a Servlet
    2. 18.2. Tomcat
      1. 18.2.1. Installing the JDK
      2. 18.2.2. Installation of Tomcat
      3. 18.2.3. Tomcat's Directory Structure
        1. 18.2.3.1. Bin
      4. 18.2.4. Conf
      5. 18.2.5. Writing and Testing a Servlet
    3. 18.3. Connecting Tomcat to Apache
      1. 18.3.1. mod_jk
  22. 19. XML and Cocoon
    1. 19.1. XML
    2. 19.2. XML and Perl
    3. 19.3. Cocoon
    4. 19.4. Cocoon 1.8 and JServ
    5. 19.5. Cocoon 2.0.3 and Tomcat
    6. 19.6. Testing Cocoon
  23. 20. The Apache API
    1. 20.1. Documentation
    2. 20.2. APR
    3. 20.3. Pools
    4. 20.4. Per-Server Configuration
    5. 20.5. Per-Directory Configuration
    6. 20.6. Per-Request Information
    7. 20.7. Access to Configuration and Request Information
    8. 20.8. Hooks, Optional Hooks, and Optional Functions
      1. 20.8.1. Hooks
      2. 20.8.2. Optional Hooks
      3. 20.8.3. Optional Hook Example
      4. 20.8.4. Optional Functions
      5. 20.8.5. Optional Function Example
    9. 20.9. Filters, Buckets, and Bucket Brigades
      1. 20.9.1. Bucket Interface
      2. 20.9.2. Output Filters
      3. 20.9.3. Input Filters
    10. 20.10. Modules
  24. 21. Writing Apache Modules
    1. 21.1. Overview
    2. 21.2. Status Codes
    3. 21.3. The Module Structure
      1. Create Per-Server Config Structure
      2. Create Per-Directory Config Structure
      3. Pre-Config (2.0)
      4. Per-Server Merger
      5. Per-Directory Merger
      6. Command Table
      7. Initializer
      8. Child Initialization
      9. Post Read Request
      10. Quick Handler (2.0)
      11. Translate Name
      12. Map to Storage (2.0)
      13. Header Parser
      14. Check Access
      15. Check User ID
      16. Check Auth
      17. Type Checker
      18. Prerun Fixups
      19. Handlers
      20. Logger
      21. Child Exit
    4. 21.4. A Complete Example
      1. 21.4.1. Overview
      2. 21.4.2. Example Output
    5. 21.5. General Hints
    6. 21.6. Porting to Apache 2.0
  25. A. The Apache 1.x API
    1. A.1. Pools
    2. A.2. Per-Server Configuration
    3. A.3. Per-Directory Configuration
    4. A.4. Per-Request Information
    5. A.5. Access to Configuration and Request Information
    6. A.6. Functions
      1. A.6.1. Pool Functions
        1. ap_make_sub_pool
        2. ap_clear_pool
        3. ap_destroy_pool
        4. ap_bytes_in_pool
        5. ap_bytes_in_free_blocks
        6. ap_palloc
        7. ap_pcalloc
        8. ap_pstrdup
        9. ap_pstrndup
        10. ap_pstrcat
      2. A.6.2. Array Functions
        1. ap_make_array
        2. ap_push_array
        3. ap_array_cat
        4. ap_copy_array
        5. ap_copy_array_hdr
        6. ap_append_arrays
      3. A.6.3. Table Functions
        1. ap_make_table
        2. ap_copy_table
        3. ap_table_elts
        4. ap_is_empty_table
        5. ap_table_set
        6. ap_table_setn
        7. ap_table_merge
        8. ap_table_mergen
        9. ap_table_add
        10. ap_table_addn
        11. ap_table_unset
        12. ap_table_ get
        13. ap_table_do
        14. ap_overlay_tables
        15. ap_clear_table
      4. A.6.4. Cleanup Functions
        1. ap_register_cleanup
        2. ap_kill_cleanup
        3. ap_cleanup_for_exec
        4. ap_note_cleanups_for_fd
        5. ap_kill_cleanups_for_fd
        6. ap_note_cleanups_for_socket
        7. ap_kill_cleanups_for_socket
        8. ap_note_cleanups_for_file
        9. ap_run_cleanup
      5. A.6.5. File and Socket Functions
        1. ap_popenf
        2. ap_pclosef
        3. ap_pfopen
        4. ap_pfdopen
        5. ap_pfclose
        6. ap_psocket
        7. ap_pclosesocket
      6. A.6.6. Regular Expression Functions
        1. ap_pregcomp
        2. ap_pregsub
        3. ap_pregfree
        4. ap_os_is_path_absolute
      7. A.6.7. Process and CGI Functions
        1. ap_note_subprocess
        2. ap_spawn_child
        3. ap_bspawn_child
        4. ap_call_exec
        5. ap_can_exec
        6. ap_add_cgi_vars
        7. ap_add_common_vars
        8. ap_scan_script_header_err
        9. ap_scan_script_header_err_buff
        10. ap_scan_script_header
      8. A.6.8. MD5 Functions
        1. ap_md5
        2. ap_md5contextTo64
        3. ap_md5digest
        4. ap_MD5Init
        5. ap_MD5Final
        6. ap_MD5Update
      9. A.6.9. Synchronization and Thread Functions
        1. A.6.9.1. Mutex functions
          1. ap_create_mutex
          2. ap_open_mutex
          3. ap_acquire_mutex
          4. ap_release_mutex
          5. ap_destroy_mutex
        2. A.6.9.2. Semaphore functions
          1. create_semaphore
          2. acquire_semaphore
          3. release_semaphore
          4. destroy_semaphore
        3. A.6.9.3. Event functions
          1. create_event
          2. open_event
          3. acquire_event
          4. set_event
          5. reset_event
          6. destroy_event
        4. A.6.9.4. Thread functions
          1. create_thread
          2. kill_thread
          3. await_thread
          4. exit_thread
          5. free_thread
      10. A.6.10. Time and Date Functions
        1. ap_ get_time
        2. ap_ht_time
        3. ap_ gm_timestr_822
        4. ap_ get_ gmtoff
        5. ap_tm2sec
        6. ap_parseHTTPdate
      11. A.6.11. String Functions
        1. ap_strcmp_match
        2. ap_strcasecmp_match
        3. ap_is_matchexp
        4. ap_getword
        5. ap_getword_white
        6. ap_getword_nulls
        7. ap_getword_conf
        8. ap_ get_token
        9. ap_find_token
        10. ap_find_last_token
        11. ap_escape_shell_cmd
        12. ap_uudecode
        13. ap_escape_html
        14. ap_checkmask
        15. ap_str_tolower
        16. ap_psprintf
        17. ap_pvsprintf
        18. ap_ind
        19. ap_rind
      12. A.6.12. Path, Filename, and URL Manipulation Functions
        1. ap_ getparents
        2. ap_no2slash
        3. ap_make_dirstr
        4. ap_make_dirstr_parent
        5. ap_make_dirstr_prefix
        6. ap_count_dirs
        7. ap_chdir_file
        8. ap_unescape_url
        9. ap_construct_server
        10. ap_construct_url
        11. ap_escape_path_segment
        12. ap_os_escape_path
        13. ap_is_directory
        14. ap_make_full_path
        15. ap_is_url
        16. ap_fnmatch
        17. ap_is_fnmatch
        18. ap_server_root_relative
        19. ap_os_canonical_filename
      13. A.6.13. User and Group Functions
        1. ap_uname2id
        2. ap_ gname2id
      14. A.6.14. TCP/IP and I/O Functions
        1. ap_ get_virthost_addr
        2. ap_ get_local_host
        3. ap_ get_remote_host
        4. ap_send_fd
        5. ap_send_fd_length
        6. ap_send_fb
        7. ap_send_fb_length
        8. ap_send_mmap
        9. ap_rwrite
        10. ap_rputc
        11. ap_rputs
        12. ap_rvputs
        13. ap_rprintf
        14. ap_rflush
        15. ap_setup_client_block
        16. ap_should_client_block
        17. ap_ get_client_block
        18. ap_send_http_header
        19. ap_send_size
      15. A.6.15. Request-Handling Functions
        1. ap_sub_req_lookup_uri
        2. ap_sub_req_lookup_file
        3. ap_run_sub_req
        4. ap_destroy_sub_req
        5. ap_internal_redirect
        6. ap_internal_redirect_handler
      16. A.6.16. Timeout and Alarm Functions
        1. ap_hard_timeout
        2. ap_keepalive_timeout
        3. ap_soft_timeout
        4. ap_reset_timeout
        5. ap_kill_timeout
        6. ap_block_alarms()
        7. ap_unblock_alarms()
        8. ap_check_alarm
      17. A.6.17. Configuration Functions
        1. ap_pcfg_openfile
        2. ap_pcfg_open_custom
        3. ap_cfg_ getc
        4. ap_cfg_ getline
        5. ap_cfg_closefile
        6. ap_check_cmd_context
        7. ap_set_file_slot
        8. ap_set_flag_slot
        9. ap_set_string_slot
        10. ap_set_string_slot_lower
      18. A.6.18. Configuration Information Functions
        1. ap_allow_options
        2. ap_allow_overrides
        3. ap_auth_type
        4. ap_auth_name
        5. ap_requires
        6. ap_satisfies
      19. A.6.19. Server Information Functions
        1. ap_ get_server_built
        2. ap_ get_server_version
        3. ap_add_version_component
      20. A.6.20. Logging Functions
        1. ap_error_log2stderr
        2. ap_log_error
        3. ap_log_reason
      21. A.6.21. Piped Log Functions
        1. ap_open_piped_log
        2. ap_close_piped_log
        3. ap_piped_log_write_fd
      22. A.6.22. Buffering Functions
        1. ap_bcreate
        2. ap_bpushfd
        3. ap_bpushh
        4. ap_bsetopt
        5. ap_bgetopt
        6. ap_bsetflag
        7. ap_bgetflag
        8. ap_bonerror
        9. ap_bnonblock
        10. ap_bfileno
        11. ap_bread
        12. ap_bgetc
        13. ap_bgets
        14. ap_blookc
        15. ap_bskiplf
        16. ap_bwrite
        17. ap_bputc
        18. ap_bputs
        19. ap_bvputs
        20. ap_bprintf
        21. ap_vbprintf
        22. ap_bflush
        23. ap_bclose
      23. A.6.23. URI Functions
        1. ap_parse_uri_components
        2. ap_parse_hostinfo_components
        3. ap_unparse_uri_components
        4. ap_pgethostbyname
        5. ap_pduphostent
      24. A.6.24. Miscellaneous Functions
        1. ap_child_terminate
        2. ap_default_port
        3. ap_is_default_port
        4. ap_default_port_for_scheme
        5. ap_http_method
        6. ap_default_type
        7. ap_ get_basic_auth_pw
        8. ap_ get_module_config
        9. ap_ get_remote_logname
        10. ap_ get_server_name
        11. ap_ get_server_port
        12. ap_is_initial_req
        13. ap_matches_request_vhost
        14. ap_os_dso_load
        15. ap_os_dso_unload
        16. ap_os_dso_sym
        17. ap_os_dso_error
        18. ap_popendir
        19. ap_pclosedir
        20. ap_psignature
        21. ap_vformatter
  26. Index
  27. About the Authors
  28. Colophon
  29. Copyright