Extending Apache 2 LinuxTag 2005, Karlsruhe Erik Abele Erik Abele Technology Consulting Apache Software Foundation
Apache History 1994 NCSA HTTPd (University of Illinois) 1995 "A patchy server" wird geboren April: Apache 0.6.2 - erstes öffentl. Release Dezember: Apache 1.0 1997 Apache 1.2.0 1998 Apache 1.3.0 1999 Gründung Apache Software Foundation 2000 Apache 2.0 Alpha 1 2002 Apache 2.0 GA 2004 Apache 2.1 Beta 1 2005 Apache 2.2, 70% Marktanteil (1.x/2.x) Ex tending Apache 2 2
Apache 2.2: New Features Basierend auf Apache Portable Runtime 1.0 MPMs (Multi-Processing Module) Smart Filtering, Caching & Load-Balancing Built-in AJP-, LDAP-, DAV- und IPv6-Support Built-in SSL/TLS und Multi-Protokoll-Support Modul-Erweiterungen & -Verbesserungen Neu: mod_dav, mod_deflate, mod_logio,... Verfeinert: mod_include, mod_negotiation,... XHTML-konforme, mehrsprachige Fehlerdokumente integriert Drastisch verbesserte Modul-API Ex tending Apache 2 3
Modulares Design Ermöglicht höchste Portabilität Multi-Processing Module (MPMs) Ermöglicht äusserste Flexibilität und Effizienz Erweiterung der Funktionalität Ca. 70 Module werden mitgeliefert Unzählige weitere Module frei verfügbar Reduktion der Funktionalität Zum Beispiel zur Verringerung des Memory-Footprints Selbst Basis-Funktionen sind als Module realisiert Ermöglicht Entwicklung von Modulen in C/C++ Offene und transparente Entwicklungs-Schnittstellen 'Cross-Platform for free' da basierend auf APR Ex tending Apache 2 4
Multi-Processing Module (MPMs) Ein MPM definiert wie der Server eingehende Anfragen empfängt und verarbeitet Verschiedene Prozess-Modelle Plattform- & OS-spezifische Optimierungen Reliability vs. Scalability vs. Performance vs. Features Auswahl eines MPMs bei der Compilierung Verfügbare Multi-Processing-Module Plattform- & OS-spezifische MPMs winnt, beos, netware, os2 Unix-/Linux-spezifische MPMs prefork, worker, event, perchild, leader, threadpool Dritthersteller-MPMs, z.b. Metux-MPM Ex tending Apache 2 5
Prefork vs. Worker Prefork Jeder Kindprozess verarbeitet jeweils nur eine Verbindung viel Verkehr, viele Kinder :) Worker Multi-threaded innerhalb eines jeden Kindprozesses jeder Thread verarbeitet jeweils eine Verbindung Ex tending Apache 2 6
'Funktionalitäts'-Module Aufteilung der Request-Verarbeitung in Phasen Header Parsing, Content-Generation, Logging,... Nahezu jede Phase kann beeinflusst werden Möglichkeit der Protokollverarbeitung Alle internen Funktionalitäten basieren grundsätzlich auch auf Modulen Ca. 70 Module mitgeliefert, Hunderte verfügbar Modul-Verwendung auch ohne Neu- Compilierung durch Dynamic Shared Objects Konfiguration i.d.r. mittels Modul-eigenen Direktiven Ex tending Apache 2 7
Mitgelieferte Module I Generatoren Filter mod_cgi(d), mod_autoindex, mod_asis, mod_info mod_deflate, mod_ext_filter, mod_include Request-Mapping mod_alias, mod_rewrite, mod_negotiation, mod_dir Access-Control Methoden: Basic und Digest Providers: file, dbm, ldap Authorisierung basierend auf z.b. Username, Gruppenzugehörigkeit, Herkunftshost, Dateibesitzer Ex tending Apache 2 8
Mitgelieferte Module II Logging, Monitoring & Debugging mod_log_config, mod_logio, mod_log_forensic mod_status, mod_info, mod_dumpio Metadaten-Verarbeitung mod_mime, mod_expires, mod_env, mod_headers (Reverse) Proxying & Load-Balancing mod_proxy mit HTTP(S)-, AJP-, FTP-Support Integrierter Load-Balancer Caching (Pre-Selection, URI-Keyed) mod_file_cache mod_cache mit Storage-Managern Disk oder Mem Ex tending Apache 2 9
Mitgelieferte Module III WebDAV mod_dav mit FS-Backend und GenericLocking-Modul Protokoll-Verarbeitung mod_ssl, mod_echo Sonstige Module Utils: mod_ident, mod_unique_id, mod_usertrack Support: mod_version, mod_ldap Experimentell: mod_filter, mod_charset_lite OS-spezifisch: mod_isapi, mod_win32, mod_netware Intern: mod_so, mod_core Veraltet: mod_cern_meta, mod_imap Ex tending Apache 2 10
Weitere verfügbare Module Apache Software Foundation mod_perl, mod_python, mod_aspdotnet, mod_tcl, mod_arm4, mod_mbox, mod_pop3 Unzählige OpenSource-Module modules.apache.org: 378 reg. Module Apache Module Report (securityspace.com) Platz 1: mod_php Platz 2: mod_ssl Platz 3: Frontpage Google: 'Apache Module', SourceForge,... Kommerzielle Module Ex tending Apache 2 11
Populäre OpenSource-Module I Embedded Languages mod_php, mod_tcl, mod_ruby, mod_mono,... Filter mod_accessibility, mod_tidy, mod_acronym mod_clamav, mod_validator, mod_csv, mod_txt mod_xhtml, mod_xml, mod_xslt, mod_upload Mass & DB-basiertes Virtual-Hosting mod_vhs, mod_vhost_mysql2 DB-basierte Authentication/Authorization mod_authn_dbi, mod_auth_form, mod_auth_sim mod_auth_mysql, mod_auth_pam, mod_auth_kerb Ex tending Apache 2 12
Populäre OpenSource-Module II Web-Frameworks mod_frontpage, mod_spin, mod_publisher Bandwidth-/Connection-Limiting bw_mod, mod_vhost_limit, mod_limitipconn IDS, Logging & Monitoring mod_security, mod_dosevasive, mod_fortress mod_log_mysql, mod_log_firstbyte, mod_uid mod_ap2_snmp, mod_arm4, mod_benchmark Miscellaneous mod_fcgid, mod_gridsite, mod_macro, mod_loadavg mod_dav_svn, mod_bt, mod_cbroker, mod_dnsbl Ex tending Apache 2 13
Modul-Installation I Statisch oder als Shared Library (DSO)? httpd -l gibt Auskunft über statisch gelinkte Module, z.b. eine Minimal-Konfiguration: Compiled in modules: core.c prefork.c http_core.c mod_so.c httpd -M gibt zus. Auskunft über die mit der angegebenen Konfiguration geladenen DSOs mod_so wird für DSO-Support benötigt Ex tending Apache 2 14
Modul-Installation II Mitgelieferte MPMs bzw. Basis-Module --with-mpm=mpm --enable-module=(shared static) --enable-modules='module-list' --enable-mods-shared='module-list' Externe Module Static --with-module=module-type:module-file Shared apxs -c mod_foo.c apxs -i -n mod_foo mod_foo.la oder./configure --with-apxs=/path/to/apxs Ex tending Apache 2 15
Modul-Konfiguration DSO-Module müssen explizit geladen werden LoadModule module_foo lib/mod_foo.so Reihenfolge nicht relevant, kein AddModule mehr Sonst wie üblich über Direktiven (httpd.conf) Siehe jew. Modul-Dokumentation (oder mod_info) Neue Container können realisiert werden Z.B. <Perl>...</Perl> Optionale Konfiguration mittels <IfModule!foo_module> Ex tending Apache 2 16
Entwicklung eigener Module Möglich in ANSI-C, C++ oder Perl (mod_perl) Apache-Quellcode und Compiler (gcc, MSVC) müssen vorhanden sein Modul-Template mittels apxs -g -n foo mod_foo.c Makefile APR bietet OS-unabhängige Funktionen: 'Cross-Platform for free' Developer-Dokumentation: make dox libapreq (Apache HTTP Request Library) Ex tending Apache 2 17
Weitere Tools Jeder Apache-Distribution liegen zahlreiche, praktische Werkzeuge bei (apache2/bin): apxs, apachectl ab (ApacheBench) htpasswd, htdigest, htdbm, dbmmanage, etc. log-server-status, rotatelogs logresolve, check_forensic, split-logfile htcacheclean suexec, checkgid ApacheMonitor (nur Win32) Weitere HTTPD-Tools: Flood, apache-test,... Ex tending Apache 2 18
Informationsquellen Ausführliche Dokumentation zu jedem Basis- Modul sowie Beschreibung der verfügbaren Direktiven unter http://httpd.apache.org/docs-2.0/mod/ http://httpd.apache.org/docs-2.1/mod/ Weitere ASF-Module unter http://httpd.apache.org/modules/ Unzählige OS- & kommerzielle Module unter http://modules.apache.org/ Ex tending Apache 2 19
That's it Thanks for listening! Weitere Informationen sowie diese Vortragsunterlagen finden Sie unter: http://www.eatc.de/ Sie erreichen mich unter erikabele@apache.org oder erik@eatc.de Ex tending Apache 2 20