Post on 15-Jun-2015
#2
Day #1
Understanding Apache Internals
Wildan Maulanawildan.m@openthinklabs.com
http://workshop.openthinklabs.com
Overview
● How to Evolution of the Web Affected the Design of Web Servers
● The Modular Architecture of the Apache Web Server and The Benefits that Each Component Provides
● How Apache Processes a Request Internally
Evolution of The Web
Static Content Dynamic Content
Apache Architecture
Multi-Processing Modules (MPMs)
Additional MPMs
● Perchild MPMMaintains several process running under different user IDs.
MPM Selection and Compatibilty
● MPM Selection Depends on many Factors :● Support for Specific Third-Party Modules and
Functionality ● Some MPMs Perform Better in Certain Platform
● Threaded MPM is preferred in most Unix platforms, including Linux and Solaris.
Hooks
● A Hook is Mechanism that Enable Apache Modules to Modify the Behavior of the Server or Other Modules
● Some of the Hooks that Apache Provides :● Connection Phase● Authorization ● Header Modification● Content Handling
Multi-Protocol Support
● Apache 2.0 can be Extended to Process Protocols Other Than HTTP● mod_ftp● mod_pop3
Content-Handling Modules
● Content Handlers and Generators are Modules that Provides the Content that will be Returned to the Browsers.● PHP5● mod_perl
Connector Modules
Apache ↔ Connector ↔ {External Application}
ex. BEA Weblogic, Tomcat Servlet Engine
Filters
● You can Think of the Filtering Architecture in Apache as a Factory Assembly Line. Filters are Workers in the Factory, and Request and Responses are the Item Traveling in the Line.● Encryption● Compression● Watermarking● Virus Scanning● Session Tracking
Access/Authentication/Authorization Modules
● These Modules Provides Mechanisms to Authenticate the Identify of a User and to Restrict Access to Spesific Resource● The Restriction Can be Done By
– Identify of the User
– Network Information (Such As the Client IP Address or Protocol Used)
– The Type of Resource Being Accessed
● There are Apache Authentication Modules for Difference Backend ● Unix-Style Password Files
● LDAP
● Barkeley-Style Databases
● Oracle
● Network Information Services (NIS)
Apache Portable Runtime (APR)● APR is Common Library for Platform-Dependent Functionality
● APR is Divided into Core Libraries (Fundamental Portable Functions) and APR Util (Other Code that Needs to be Portable).
● APR Core Covers the Following :● File Creation and Manipulation
● Socket Programming
● Threads and Processes
● String Management
● Shared Memory
● APR Util Covers These Areas :● DBM Database Abstraction Layer
● XML Library
● Digest
● Base64 Encoding
A Day in the Life of a Request
A Day in the Life of a Request● Apache Startup
● Request Process
● Checking for Hooks● URI Translation Phase● Access Control Phase● Authentication● Authorization● MIME-Type Checking● Filters● Content Handler● Logging● Cleanup
Q&Ahttp://workshop.openthinklabs.com/resources
Reference
● Daniel Lopez Ridruezo; SAMS Teach Yourself Apache2 in 24 Hours, SAMS Publishing, 2002 (Buy this book on Amazon)