Sams Teach Yourself Apache 2 in 24 Hours

Book description

Sams Teach Yourself Apache in 24 Hours covers the installation, configuration, and ongoing administration of the Apache Web server, the most popular Internet Web server. It covers both the 1.3 and the new 2.0 versions of Apache.

Using a hands-on, task-oriented format, it concentrates on the most popular features and common quirks of the server.

The first part of the book helps the reader build, configure, and get started with Apache. After completing these chapters the reader will be able to start, stop, and monitor the Web server. He also will be able to serve both static content and dynamic content, customize the logs, and restrict access to certain parts of the Web server.

The second part of the book explains in detail the architecture of Apache and how to extend the server via third-party modules like PHP and Tomcat. It covers server performance and scalability, content management, and how to set up a secure server with SSL.

Table of contents

  1. Copyright
    1. Dedication
  2. Foreword
  3. Lead Author
    1. Contributing Author
  4. Acknowledgments
  5. We Want to Hear from You!
  6. Introduction
    1. So, What Does This Book Have to Say?
    2. Who Should Read This Book?
      1. What Is Required to Read This Book?
    3. Why Is This Book Better than Other Apache Books?
    4. Structure of This Book
    5. Conventions Used in This Book
  7. I. Basic Apache
    1. 1. Apache and the Web
      1. Internet Protocols
        1. TCP/IP
        2. DNS
        3. HTTP
        4. URL
        5. SSL
      2. HTTP Internals
      3. Do It Yourself HTTP
      4. Web Servers History
        1. How It All Got Started
        2. Apache
        3. Apache Software Foundation
      5. Apache Considerations
        1. Advantages of Apache
          1. Open Source
          2. Stability and Scalability
          3. Security
          4. Flexibility
          5. Performance
          6. Multiplatform
          7. Extensible
          8. Works with Multiple Languages
          9. Service Providers
          10. Popular; It Is Easy to Get Expertise
          11. Standards Compliance
        2. Disadvantages
          1. Not a Company
          2. Open Source
          3. Configuration
          4. Performance
      6. Summary
      7. Q&A
      8. Further Reading
    2. 2. Understanding Apache Internals
      1. Evolution of the Web
      2. Apache Architecture
        1. Multi-Processing Modules
          1. Process-Based Server
          2. Threaded Server
          3. Hybrid Server
        2. Additional MPMs
        3. MPM Selection and Compatibility
      3. Hooks
      4. Multi-Protocol Support
      5. Content-Handling Modules
      6. Connector Modules
      7. Filters
      8. Access/Authentication/Authorization Modules
      9. Apache Portable Runtime
      10. A Day in the Life of a Request
        1. Apache Startup
        2. Request Process
        3. Checking for Hooks
      11. Summary
      12. Q&A
      13. Quiz
      14. Further Reading
    3. 3. Installing and Building Apache
      1. Choosing the Appropriate Installation Method
        1. Building from Source
        2. Installing a Binary
        3. Apache Version Naming
      2. Installing Apache on Unix
        1. Checking Whether Apache Is Already Installed in Your System
        2. Installing from Source
          1. Downloading the Apache Source Code
          2. Uncompressing the Source Code
          3. Configuring the Software
          4. Compiling and Installing Apache
          5. Apache Compilation Options
            1. Selecting the Appropriate MPM
        3. Installing Binaries
          1. Binaries from the Apache Web Site
          2. Distribution-Specific Packages
        4. Building from CVS
          1. The CVS Client
          2. Checking Out the Source
          3. Building the configure Script
          4. Check Out a Specific Version of Apache
      3. Installing Apache on Windows
        1. Notes About the Windows Installer
      4. Verifying the Integrity of Downloaded Software
      5. Commercial Alternatives
      6. Summary
      7. Q&A
      8. Quiz
      9. Further Reading
    4. 4. Getting Started with Apache
      1. Layout of Server Files and Directories
        1. Apache Binary and Support Scripts
        2. Log Files
        3. Configuration Files
        4. CGI Scripts Location
        5. Build Information and Header Files
        6. Error Messages
        7. Manual Pages
        8. Modules and Libraries Directory
        9. Web Pages and Images
        10. Installation Differences
      2. Configuration Files Structure
        1. Directives
        2. Containers
        3. Conditional Evaluation
        4. ServerRoot
        5. Including Additional Configuration Files
        6. Per-Directory Configuration Files
        7. Merging Rules
        8. Additional Configuration Files
        9. Minimal Apache Configuration
      3. Log Files
        1. access_log
        2. error_log
        3. Additional Files
      4. Apache-Related Commands
        1. Apache Server Binary
        2. Controlling Apache on Windows
        3. Apache Control Script
      5. Starting Apache for the First Time
      6. Troubleshooting
        1. Existing Web Server
        2. No Permission to Bind to Port
        3. Access Denied
        4. Wrong Group Settings
      7. Summary
      8. Q&A
      9. Quiz
      10. Related Directives
      11. Further Reading
    5. 5. Using Apache to Serve Static Content
      1. Addresses, Ports, and Server Names
      2. The ServerName Directive
      3. Customizing the Web Server
        1. Error Messages
          1. The ErrorDocument Directive
          2. International Error Messages
          3. Handling URL Errors: mod_speling
        2. Customizing Server Information
          1. Server Identification
          2. Contact Information
      4. Aliasing and Mapping of Resources
      5. URL Redirection
      6. MIME Types
        1. Defining MIME Types
        2. MIME Magic
        3. The ForceType Directive
      7. Content Handlers
      8. Directory Listings
        1. Default Document Index
        2. Directory Indexing
        3. Forbidding Directory Access
        4. Trailing Slash
      9. Icons for Bookmarks
      10. Summary
      11. Q&A
      12. Quiz
      13. Related Directives
        1. Listening and Hostname
        2. Customization
        3. Site Structure
        4. Directory Listings
        5. MIME and File Handlers
      14. Further Reading
    6. 6. Serving Dynamic Content with CGI
      1. Common Gateway Interface
        1. CGI Protocol
        2. CGI Operation
        3. CGI Environment Variables
        4. CGI Response
      2. Advantages and Disadvantages of CGI Scripts
        1. Portability
        2. Simplicity
        3. Existing Code
        4. Source Hiding
        5. Memory Leaks
        6. Performance
        7. Code and Presentation
      3. Configuring Apache
        1. CGI Content
          1. ScriptAlias
          2. Fine-Grained Control
          3. Action and Script
        2. CGI Security
        3. Non Parse Headers (NPH) Scripts
        4. Debugging CGI Execution
      4. Unix Configuration
        1. Testing Shell Script CGIs
        2. Perl Installation
          1. Preinstalled Perl
          2. Installing Binaries
            1. Linux
            2. Solaris Packages
          3. Installing from Source
        3. Testing Perl CGI Scripts
      5. Windows Configuration
        1. Testing Batch File CGIs
        2. Perl on Windows
          1. Testing Perl Scripts
      6. Enhancing Your CGI Performance
        1. mod_perl
        2. FastCGI
      7. Common CGI Problems
        1. Forbidden Error
          1. Filesystem Permissions
          2. CGI Execute Permissions
        2. Internal Server Error
          1. Program Permissions
          2. Interpreter Location
          3. Malformed Headers
          4. Other Causes
        3. Source Code in the Browser
      8. Summary
      9. Q&A
      10. Quiz
      11. Related Directives
        1. Associating Resources as CGI
        2. Debugging and mod_cgid
      12. Further Reading
    7. 7. Restricting Access
      1. Authentication
      2. Client Authentication
        1. User Management
      3. Apache Authentication Modules
        1. Common Functionality
        2. Module Functionality
        3. File-Based Authentication
          1. Backend Storage
          2. User Management
          3. Authoritative
          4. Using mod_auth
        4. Database File-Based Access Control
          1. Backend Storage
          2. User Management
          3. Authoritative
          4. Using mod_auth_dbm
        5. Digest-Based Authentication
          1. Backend Storage
          2. User Management
          3. Authoritative
          4. Additional Directives
          5. Using mod_auth_digest
        6. Additional Authentication Modules
      4. Access Control
        1. Access Rules
          1. IP Addresses
            1. A Partial IP Address
            2. A Network/Mask Pair
          2. Domain Name
          3. Environment Variables
          4. All Clients
        2. Access Rules Evaluation
          1. Deny,Allow
          2. Allow,Deny
          3. Mutual-Failure
      5. Combining Access Methods
      6. Limiting Access Based on HTTP Methods
      7. Summary
      8. Q&A
      9. Quiz
      10. Related Directives
        1. Common Authentication
        2. File-Based Authentication
        3. Database File-Based Authentication
        4. Digest Authentication
        5. Access Control
      11. Further Reading
    8. 8. Logging and Monitoring
      1. Logging HTTP Requests
        1. What Do You Want to Log?
          1. Additional Logging Parameters
        2. Where Do You Want to Log the Information?
          1. Logging to Files
          2. Logging to a Program
          3. Logging to Databases
          4. Cluster Logging
        3. Conditional Logging
          1. The HostNameLookups Directive
          2. The IdentityCheck Directive
          3. Environment Variables
          4. Status Code
      2. Error Messages
        1. Logging to a File
        2. Logging to a Program
        3. The syslog Daemon Argument
        4. The LogLevel Directive
      3. Monitoring Apache
        1. Configuring Modules
        2. Additional Configuration
        3. Additional Log Files
      4. Managing Logs
        1. Resolving Hostnames
        2. Log Rotation
        3. Merging and Splitting Logs
        4. Logging to Databases
        5. Log Analysis
        6. Monitoring Error Logs
      5. Common Errors
        1. Connection Reset by Peer
        2. File favico.icon Not Found
        3. File robots.txt Not Found
        4. httpd.pid Overwritten
      6. Summary
      7. Q&A
      8. Quiz
      9. Quiz Answers
      10. Related Directives
      11. Further Reading
    9. 9. Content Negotiation and Environment Variables
      1. Environment Variables
        1. Standard Environment Variables
        2. Setting Environment Variables Dynamically
        3. Special Environment Variables
      2. Header Manipulation
      3. Content Negotiation
        1. Content Encoding
        2. Character Sets
        3. Negotiation
          1. Client Negotiation
          2. Server Configuration
            1. Multiviews
            2. Type Maps
          3. The Vary: Header
      4. Summary
      5. Q&A
      6. Quiz
      7. Related Directives
        1. Environment Variables
        2. Header Manipulation
        3. Content Negotiation
      8. Further Reading
    10. 10. Apache GUIs
      1. GUIs and Text-Based Configuration
        1. Using Text Files for Configuration
        2. Using a GUI for Configuration
      2. Webmin
        1. Installing Webmin
        2. Managing Webmin
        3. Configuring Apache Settings
          1. Configuring Virtual Hosts
          2. Editing Configuration Files Directly
          3. Configuring Containers
          4. Delegated Administration
      3. Comanche
        1. Installing Comanche
          1. Installing on Windows
          2. Installing on Unix
        2. Using Comanche
          1. Server Information
          2. Server Configuration
        3. Extending Comanche
      4. Additional GUI Tools
      5. Summary
      6. Q&A
      7. Quiz
      8. Further Reading
  8. II. Advanced Apache
    1. 11. Multi-Processing Modules
      1. Overview of Apache MPM Architecture
      2. The Prefork MPM
        1. Prefork MPM Configuration
          1. Controlling the Number of Processes
          2. Server Identity
          3. Network-Related Directives
          4. Coordinating Children
          5. Keeping Track of Processes
          6. The CoreDumpDirectory Directive
      3. The Worker MPM
        1. Worker MPM Configuration
          1. Processes and Threads
          2. Common Directives
      4. Perchild MPM
        1. Perchild MPM Configuration
          1. Assigning Requests to Processes
          2. Common Directives
      5. Windows MPM
        1. Windows MPM Configuration
      6. Which MPM Is Best for Me?
        1. Selecting an MPM
        2. Additional MPMs
        3. Configuration Limits
      7. Summary
      8. Q&A
      9. Quiz
      10. Related Directives
      11. Further Reading
    2. 12. Filtering Modules
      1. Apache Filtering Architecture
      2. Filter Configuration
        1. Configuration Directives
      3. Compressing Content with mod_deflate
        1. Configuring mod_deflate
        2. Limitations
      4. Server Side Includes
        1. Configuring SSI
      5. SSI Directives
        1. Additional Configuration Directives
      6. External Filtering
        1. Configuring External Filtering
      7. Additional Filtering Modules
      8. Summary
      9. Q&A
      10. Quiz
      11. Related Directives
        1. General Directives
        2. mod_deflate
        3. mod_include
        4. mod_ext_filter
      12. Further Reading
    3. 13. Publishing Extensions
      1. The Need for a Publishing Protocol
        1. Windows as a Web Server Platform
        2. Separation of Tasks
        3. Web Hosting
      2. The DAV Protocol
      3. Apache and DAV
        1. Configuring DAV
        2. Restricting Access
        3. Advanced Configuration
          1. DAVMinTimeout
          2. LimitXMLRequestBody
          3. DavDepthInfinity
      4. DAV Clients
        1. Microsoft Clients
          1. Adding a Web Folder from Explorer
          2. Adding a Web Folder Using a Wizard
          3. Editing a File Directly from Office
        2. Unix Clients
          1. Installation
          2. Usage
      5. Additional DAV Projects
        1. Subversion
        2. DAV File Systems
        3. Slide
        4. Future Enhancements for DAV
      6. Common Error Messages
        1. Lock Database
        2. Web Folders
      7. Microsoft FrontPage
        1. Should I Use DAV or FrontPage Extensions?
      8. Summary
      9. Q&A
      10. Quiz
      11. Related Directives
      12. Further Reading
    4. 14. Virtual Hosting
      1. The Case for Virtual Hosts
      2. DNS and Virtual Hosting
      3. Network Interfaces and IP Aliases
      4. IP-Based Virtual Hosting
      5. Name-Based Virtual Hosts
      6. Mass Virtual Hosting
      7. Other Virtual Hosting Techniques
      8. Security Considerations
      9. Performance Considerations
      10. Running Multiple Apache Instances on a Machine
      11. Summary
      12. Q&A
      13. Quiz
      14. Related Directives
      15. Further Reading
    5. 15. Apache as a Proxy Server
      1. Introduction to Proxy Servers
      2. Enable Proxy Support for Apache
        1. Building Apache from Source
        2. Binary Installations
      3. Apache as a Forward Proxy
        1. Apache Forward Proxy Configuration
          1. Enabling Proxy Functionality
          2. URL Blocking
          3. Proxy Hierarchy
            1. ProxyRemote
            2. NoProxy
            3. ProxyDomain
            4. ProxyMaxForwards
            5. ProxyVia
          4. Tuning
        2. Configuring Client Support
          1. Configuring Internet Explorer
          2. Configuring Mozilla
      4. Caching
        1. Caching Backends
          1. Building Apache from Source
          2. Binary Installations
        2. Caching Configuration
          1. What to Cache
          2. How Long to Cache
            1. CacheMaxExpire
            2. CacheLastModifiedFactor
            3. CacheForceCompletion
            4. CacheDefaultExpire
      5. Apache as a Reverse Proxy
        1. Reverse Proxy Configuration
          1. Specifying Reverse Proxy URLs
          2. Preventing URLs from Being Reverse Proxied
          3. The ProxyErrorOverride Directive
          4. The ProxyPreserveHost Directive
          5. Additional Headers
      6. Related Open Source and Commercial Products
      7. Summary
      8. Q&A
      9. Quiz
      10. Related Directives
        1. Forward Proxy Directives
        2. Reverse Proxy Directives
        3. Caching Directives
      11. Further Reading
    6. 16. Tuning Apache
      1. Scalability
        1. Operating System Limits
          1. Processes
          2. File Descriptors
          3. Controlling External Processes
        2. Apache Settings
          1. File System Access
          2. Network and Status Settings
      2. Load Testing Your Web Site
        1. ApacheBench
        2. JMeter
      3. Tuning Apache for Performance
        1. Mapping Files to Memory
        2. Distributing the Load
        3. Caching
        4. Reduce Transmitted Data
        5. Network Settings
        6. Performance Tuning for Specific Apache Modules
        7. Loadable Modules
      4. Preventing Abuse
        1. Robots
      5. Troubleshooting
      6. Summary
      7. Q&A
      8. Quiz
      9. Related Directives
        1. Preventing Abuse
        2. Network Settings
        3. Processes Limits
        4. File Related
      10. Further Reading
    7. 17. Setting Up a Secure Server
      1. The Need for Security
        1. Confidentiality
        2. Integrity
        3. Authentication
      2. The SSL Protocol
        1. Confidentiality
          1. Symmetric Cryptography
          2. Public Key Cryptography
        2. Integrity
        3. Authentication
          1. SSL and Certificates
          2. SSL Protocol Summary
      3. Installing SSL
        1. OpenSSL
          1. Windows
          2. Unix
        2. mod_ssl
          1. Unix
      4. Managing Certificates
        1. Creating a Key Pair
        2. Creating a Certificate Signing Request
        3. Creating a Self-Signed Certificate
      5. SSL Configuration
        1. Starting the Server
        2. Configuration Directives
          1. Algorithms
          2. Client Certificates
          3. Performance
          4. Logging
        3. The SSLOptions Directive
        4. Access Control
        5. Reverse Proxy with SSL
      6. Problems with Specific Browser Versions
      7. Summary
      8. Q&A
      9. Quiz
      10. Related Directives
        1. Keys and Certificates
        2. SSL Protocol
        3. Performance
        4. Others
        5. Reverse Proxy
      11. Further Reading
  9. III. Extending Apache
    1. 18. Extending Apache
      1. Modules Included with Apache
        1. Enabling or Disabling Modules
        2. Environment Variables
          1. mod_env
          2. mod_setenvif
          3. mod_unique_id
        3. Content Type Decisions
          1. mod_mime
          2. mod_mime_magic
          3. mod_negotiation
          4. mod_charset_lite
        4. URL Mapping and Manipulation
          1. mod_alias
          2. mod_rewrite
          3. mod_userdir
          4. mod_speling
          5. mod_vhost_alias
        5. Directory Handling
          1. mod_dir
          2. mod_autoindex
        6. Authentication and Access Control
          1. mod_access
          2. mod_auth
          3. mod_auth_dbm
          4. mod_auth_anon
          5. mod_auth_digest
        7. HTTP Headers
          1. mod_headers
          2. mod_cern_meta
          3. mod_expires
          4. mod_asis
        8. Dynamic Content
          1. mod_include
          2. mod_cgi
          3. mod_cgid
          4. mod_actions
          5. mod_isapi
          6. mod_ext_filter
          7. mod_suexec
        9. Monitoring
          1. mod_status
          2. mod_info
        10. Logging
          1. mod_log_config
          2. mod_usertrack
        11. Proxy Support
          1. mod_proxy
          2. mod_proxy_connect
          3. mod_proxy_ftp
          4. mod_proxy_http
        12. Loadable Module Support
          1. mod_so
        13. Caching
          1. mod_file_cache
          2. mod_cache
          3. mod_disk_cache
          4. mod_mem_cache
        14. Document Authoring and Versioning
          1. mod_dav
          2. mod_dav_fs
        15. Sample Modules
          1. mod_example
          2. mod_case_filter, mod_case_filter_in
        16. Miscellaneous Modules
          1. mod_imap
          2. mod_ssl
          3. mod_deflate
      2. The Apache Extension Tool APXS
        1. Usage
        2. Additional Options
      3. Extending Apache with Third-Party Modules
      4. Summary
      5. Q&A
      6. Quiz
      7. Further Reading
    2. 19. PHP
      1. Introduction to PHP
        1. PHP History
        2. PHP Architecture
        3. PHP Advantages
          1. Easy to Learn
          2. Open Source
          3. Community
          4. Database Support
          5. Multiplatform Support
          6. Extensions
          7. Safe Mode
          8. Session Support
          9. Rapid Development
          10. Commercial Support
          11. It's Fun!
        4. PHP Disadvantages
          1. Code Maintenance
          2. Advanced Features
          3. Dependency Tracking
          4. Corporate Acceptance
      2. Installation
        1. Installation on Windows
          1. PHP as a CGI Script
          2. Testing That Installation Was Successful
        2. Installing on Unix
          1. Binary Installation
          2. Source Code Installation
            1. Getting PHP
            2. Compiling PHP
      3. PHP Extensions
        1. General Options
        2. Graphics Support
        3. Flash Animation
        4. PDF Generation
        5. Database Support
        6. XML Support
        7. Session Support
      4. PHP Configuration
        1. PHP Language
        2. Error Manipulation
        3. Output Manipulation
        4. Security
        5. Dynamic Extension Support
      5. Summary
      6. Q&A
      7. Quiz
      8. Related Directives
      9. Further Reading
        1. Support
        2. PHP Books
        3. Web Sites
        4. Commercial Vendors
        5. Open Source Solutions
    3. 20. mod_perl
      1. What Is mod_perl?
      2. The mod_perl API
      3. Building and Installing mod_perl
        1. Installing mod_perl from CPAN
        2. Installing from CVS
        3. Both CPAN and CVS Installations
        4. Hello World with mod_perl
      4. CGI Acceleration
      5. Page Components and Templating
      6. Access, Authentication, and Authorization
      7. Architecting a Scalable mod_perl Infrastructure
      8. Summary
      9. Q&A
      10. Quiz
      11. Further Reading
    4. 21. Tomcat and Apache
      1. A Little History of Java Servlets
      2. Servlet Container Integration with Apache
      3. Installing and Running Tomcat
        1. Installing on Unix
        2. Installing on Windows
      4. Connecting the Apache Web Server to Tomcat
      5. Java Web Applications
      6. Build Your Own Webapp
      7. Accessing SSL Variables
      8. Building mod_jk
      9. Summary
      10. Q&A
      11. Quiz
      12. Related Directives
      13. Further Reading
    5. 22. Dynamic URI Resolution with mod_rewrite
      1. Basic Redirects and Aliases Review
      2. Rules-Driven Content Mapping and Redirection
      3. Zen and the Art of mod_rewrite
      4. Super-Charge Your Redirects
      5. Random Acts
      6. Dynamic Content
      7. Using mod_rewrite for Authorization
      8. Flexible Proxying
      9. Dynamic Proxying and Load Balancing
      10. Virtual Hosting
      11. Summary
      12. Q&A
      13. Quiz
      14. Related Directives
      15. Further Reading
    6. 23. Migrating to Apache 2.0
      1. Apache 1.3
        1. Migrating to Apache 2.0
          1. Performance
          2. Improved Functionality
          3. Improved Windows Support
          4. Protocol Modules
          5. Reasons Not to Migrate to Apache 2.0
        2. Migration Help: Apache 1.3 to Apache 2.0
          1. Configuration Changes
          2. Apache Modules
          3. Running Both
      2. Microsoft Internet Information Server
        1. Migration to Apache 2.0
          1. Security
          2. Stability
          3. Standardization
          4. Development
          5. Features
          6. Reasons Not to Migrate from IIS
        2. Migration Help: IIS to Apache 2.0
          1. GUI Configuration
          2. Development
            1. ASP Engines
            2. PHP
            3. Java
            4. Additional Software
            5. Extending the Server
            6. Consolidated Server
            7. Reverse Proxy
        3. IPlanet
        4. Migrating to Apache 2.0 from IPlanet
          1. Reasons Not to Migrate from IPlanet
        5. Migration Help: IPlanet to Apache 2.0
      3. General Migration Advice
      4. Summary
      5. Q&A
      6. Further Reading
    7. 24. Additional Apache Modules and Projects
      1. Apache 2.0 Modules
        1. LDAP
        2. POP3
        3. Mailing List Archiving
        4. Bandwidth Management
        5. Extending Apache with C++
        6. mod_snake
        7. Tcl
        8. XSLT Module
        9. mod_mya
        10. mod_bakery
        11. mod_v2h
        12. Commercial Modules
          1. BEA
          2. Enterprise Ready Server
      2. ASF Projects
        1. Java and Apache
          1. Tomcat
          2. Ant
          3. Taglibs
          4. Struts
          5. James
          6. Avalon
          7. Jakarta Commons
        2. The Apache XML Project
          1. XML Parsers
          2. XML Manipulation
      3. Apache Resources
        1. Apache Support
          1. Mailing Lists
          2. Apache Bug Database
          3. Apache Newsgroups
        2. Apache News
        3. ApacheCon
        4. Commercial Support
        5. Additional Modules
      4. Summary
      5. Q&A
    8. A. The Apache Software License

Product information

  • Title: Sams Teach Yourself Apache 2 in 24 Hours
  • Author(s): Daniel López Ridruejo, Ian Kallen
  • Release date: June 2002
  • Publisher(s): Sams
  • ISBN: 0672323559