You are previewing Apache Phrasebook.
O'Reilly logo
Apache Phrasebook

Book Description

What is the new essential for Apache developers? The Apache Phrasebook. Packed with practical solutions, or "phrases," for tasks that the Apache developer much accomplish every day, the phrasebook fills the need for a short, functional, to-the-point reference for Apache. The code contained in the phrasebook is flexible, so it can be easily adapted to your needs. Today's problem is likely to be tomorrow's problem, so don't waste your time on lengthy tutorials. Go straight to practical Apache tools that provide immediately applicable solutions for any situation with the Apache Phrasebook.

Table of Contents

  1. Copyright
    1. Dedication
  2. About the Authors
  3. Acknowledgments
  4. We Want to Hear from You!
  5. Reader Services
  6. Introduction
  7. 1. Apache Basics
    1. Discovering Apache
    2. Determining Whether Apache Is Already Installed
    3. Installing Apache 1.3 on Linux and Unix
    4. Installing Apache 2.0 on Linux and Unix
    5. Installing Apache on Windows
    6. Configuration File Basics
    7. Using Multiple Configuration Files
    8. Starting, Stopping, and Restarting Apache
    9. Changing the Address and Port Apache Uses
    10. Changing the User Apache Runs As
    11. Specifying a Server Name
    12. Providing an Icon for my Web Page
    13. Discovering the Modules Available on the Server
    14. Enabling and Disabling Individual Modules
    15. Adding Modules after Compiling Apache Without Recompiling
    16. Publishing Content
      1. Default Apache Directive Containers
      2. Directive Containers for Conditional Evaluation
  8. 2. Troubleshooting
    1. Help! My Apache Server Does Not Work!
    2. The Error Log
    3. Logging to the System Log Daemon
    4. Controlling the Amount of Information Logged
    5. Testing the Apache Configuration for Problems
    6. Testing Apache from the Command Line
    7. Checking That Apache Is Running
    8. Alternate Ways of Stopping Apache
    9. Using Apache to Debug Apache
    10. Startup Errors
      1. Syntax Error
      2. Address Already in Use
      3. Could Not Bind to Port
      4. Module Not Compatible
      5. Name Resolution
      6. Cannot Open Log or Configuration File
    11. Access Denied Errors
    12. Internal Server Errors
      1. Segmentation Faults
      2. Premature End of Script Headers
      3. Malformed Headers
    13. Additional Error Log Files
    14. Redirections Do Not Work
    15. Troubleshooting Checklist
      1. Starting the Server
      2. Connecting to the Server
      3. Document Not Found
      4. Access Forbidden
      5. Internal Server Errors
      6. If All Else Fails
  9. 3. Logs and Monitoring
    1. Introduction to Logging in Apache
    2. Default Apache Log Files
    3. Creating Log Formats
    4. Creating a Custom Log File
    5. Redirecting Logs to an External Program
    6. Logging Requests Conditionally
    7. Monitoring Who Is Linking to Your Website
    8. Monitoring Apache with mod_status
    9. Monitoring Apache with SNMP
    10. Analyzing Your Logs with Open-source Tools
    11. Monitoring Your Logs in Real Time
    12. Logging Requests to a Database
    13. Rotating and Archiving Logs
    14. Controlling IP Address Resolution
    15. Processing Logged IP Addresses
    16. Restarting Apache Automatically If It Fails
    17. Merging and Splitting Log Files
    18. Keeping Separate Logs for Each Virtual Host
    19. Common Log Entries
      1. File favicon.ico Not Found
      2. File robots.txt Not Found
      3. Overwritten
      4. Long, Strange Requests
  10. 4. URL Mapping and Dynamic Content
    1. URL Mapping
    2. Mapping URLs to Files with Alias
    3. Mapping URL Patterns to Files with AliasMatch
    4. Redirecting a Page to Another Location
    5. Redirecting to the Latest Version of a File
    6. Redirecting Failed or Unauthorized Requests
    7. Defining Content Handlers
    8. Understanding MIME Types
    9. Configuring MIME Types
    10. Basics of Running CGI Scripts
    11. Marking Resources As Executable CGIs
    12. Associating Scripts with HTTP Methods and MIME Types
    13. Troubleshooting the Execution of CGI Scripts
    14. Improving CGI Script Performance
    15. Understanding Server Side Includes
    16. Configuring Server Side Includes
    17. Setting Environment Variables
    18. Setting Environment Variables Dynamically
    19. Special Environment Variables
    20. Understanding Content Negotiation
    21. Configuring Content Negotiation
    22. Assigning Default Charsets and Language Priorities
    23. Advanced URL Mapping with mod_rewrite
    24. Understanding the “Trailing Slash” Problem
    25. Fixing Spelling Mistakes
    26. Fixing Capitalization Problems
    27. Validating Your Pages with Tidy
  11. 5. Virtual Hosting
    1. What Is Virtual Hosting?
    2. What Is IP-based Virtual Hosting?
    3. Configuring IP-based Virtual Hosting
    4. What Is Name-based Virtual Hosting?
    5. Configuring Name-based Virtual Hosting
    6. What Happens If a Request Does Not Match Any Virtual Host?
    7. Configuring a Default Name-based Virtual Host
    8. Configuring a Default IP-based Virtual Host
    9. Mixing Name-based and IP-based Virtual Hosts
    10. Debugging Virtual Host Setups
    11. Using SSL with Name-based Virtual Hosts
    12. Alternate Virtual Hosting
    13. Alternate Virtual Hosting Modules
    14. Per-directory Configuration Files
    15. Controlling the Scope of Per-directory Configuration Files
    16. Disabling Per-directory Configuration Files
  12. 6. Security and Access Control
    1. Understanding the Need for Access Control
    2. Differences Between Apache Versions
    3. Understanding Basic and Digest Authentication
    4. Introducing Apache Access Control
    5. Introducing Apache Authorization and Authentication Configuration
    6. Creating a User Database
    7. Using Require to Authorize Users and Groups
    8. Handling a Large Number of Users
    9. Allowing Access Only to Specific IP Addresses
    10. Denying Access to Specific IP Addresses
    11. Combining Access Control Methods
    12. Customizing Your Access Denied Page
    13. Putting Users in Control
    14. Denying Access to System and Sensitive Files
    15. Restricting Program Execution
    16. Preventing Abuse
    17. Disabling Directory Listings
    18. Changing the Server: Header
    19. Preventing Hotlinking to Your Images
    20. Restricting Specific HTTP Methods
    21. Restricting Access Based on the Browser Type
    22. Using Location and Directory Sections
    23. Additional Authentication Modules
      1. mod_security
    24. Apache 2.2
    25. Keeping Up to Date with Apache Security
    26. Security Checklist
      1. Disable Unneeded Modules
      2. Remove Sample Scripts
      3. Limit or Disable CGI Execution and SSI
      4. Check File Permissions
      5. Limit or Disable Proxy Functionality
      6. Restrict Access to Your Server by Default
  13. 7. SSL/TLS
    1. What Is SSL?
    2. How Does SSL Work?
    3. Compiling OpenSSL
    4. Encryption Keys
    5. Creating a Key Pair
    6. Creating a Password-protected Key Pair
    7. Remove the Password from a Key
    8. Certificates
    9. Creating a Certificate Signing Request
    10. Showing the Contents of a Certificate Signing Request
    11. Creating a Self-signed Certificate
    12. Compiling SSL Support in Apache 1.3
    13. Compiling SSL Support in Apache 2.x
    14. Minimal Apache Configuration
    15. Starting Apache with SSL Support
    16. SSLPassPhraseDialog
    17. Improving SSL Performance
    18. Forcing All Content to Be Served Using SSL
    19. SSL and Name-based SSL Virtual Hosts
    20. Using Apache Auth Modules with SSL
    21. Warning Messages When Accessing an SSL-enabled Website
    22. Creating Client Certificates
    23. Authentication Using Client Certificates
    24. Alternatives to mod_ssl
    25. Testing SSL-enabled Websites from the Command Line
    26. Working Around Buggy SSL Implementations
    27. Complex Access Control with mod_ssl
    28. Related Chapters
  14. 8. Content Publishing with DAV
    1. Content Publishing and Apache
    2. Introducing WebDAV
    3. Advantages of Using mod_dav
    4. WebDAV and the HTTP Protocol
    5. Installing mod_dav on Apache 2.0
    6. Installing mod_dav on Apache 1.3
    7. Basic WebDAV Configuration
    8. Securing Your WebDAV Configuration
    9. Accessing DAV Resources from Microsoft Office
    10. Accessing DAV from Microsoft Windows
    11. Accessing DAV Resources from Firefox
    12. Accessing DAV from the Command Line
    13. Dealing with Buggy Clients
    14. mod_speling and DAV
    15. Dynamic Content and DAV
    16. Enabling Per-user Pages
    17. Alternate User Directories
    18. Fixing Problems with DAVLockDB
  15. 9. Performance and Scalability
    1. Tuning Apache
    2. Understanding Performance and Scalability
    3. Tuning Your Hardware
    4. Increasing OS Limits
    5. Increasing OS Limits on Processes
    6. Increasing OS File Descriptors
    7. Controlling External Processes
    8. Improving File System Performance
      1. Mounting File Systems with noatime Option
    9. Handling Symbolic Links
      1. Disabling Per-directory Configuration Files
      2. Configuring Content Negotiation
      3. Disabling or Minimizing Logging
    10. Tuning Network and Status Settings
      1. HostnameLookups
      2. Request Accept Mechanism
      3. mod_status
      4. AcceptFilter
      5. KeepAlives
    11. Preventing Abuse
    12. Limiting Connections and Bandwidth
    13. Dealing with Robots
    14. Reverse Proxies and Load Balancers
    15. Caching and Compression
    16. Module-specific Optimizations
    17. Alternatives to Apache
  16. 10. Apache Proxy and Caching Support
    1. Understanding the Need for Caching and Proxies
    2. Understanding Forward and Reverse Proxies
    3. Differences Between Apache 1.3, 2.0, and 2.2
    4. Enabling mod_proxy Support
    5. Enabling Forward Proxy Support
    6. Using a Reverse Proxy to Unify Your URL Space
    7. Hiding the Backend Servers
    8. Preventing URLs from Being Reverse Proxied
    9. Improving Performance
    10. Offloading SSL Processing
    11. Passing Proxy Information in Headers
    12. Manipulating Headers
    13. Implementing a Caching Proxy
    14. Caching in Apache 2
    15. Load Balancing
    16. Connecting to Tomcat
    17. Alternate Proxies
    18. Transparent HTTP Proxies
  17. 11. Multi Processing and Protocol Modules
    1. The Evolution of Apache’s Architecture
    2. Selecting a Multi Processing Module
    3. Understanding Process-Based MPMs
    4. Configuring the Prefork MPM
    5. Understanding Threaded and Hybrid MPMs
    6. Configuring the Worker MPM
    7. Using Alternate MPMs
    8. Understanding Apache 2 Filters
    9. Using Apache As an FTP Server
    10. Using Apache As a POP3 Server
    11. Compressing Content on the Fly