Getting Up and Running with Apache 2.0 on Linux
LinuxWorld SF 2004: New York City, August 2nd, 2004.
Introduction (Slide Two)
i am who i am who i am who am i requesting some enlightenment could I have been anyone other than me?"
-from Dancing Nancies, Dave Matthews Band
Introduction (Slide Three)
- the topic at hand: apache 2.0
- what we'll cover in the next 3 hours
- history of
- make up of
- getting our hands on
- what's on hand
- configuring, building
- configuring, migrating to
- adding third-party modules
- fine tuning
- future of
- what we'll cover in the next 3 hours
Introduction (Slide Four)
- the topic at hand: apache 2.0
- what we won't cover
- detailed changes in apache source code
- detailed changes in apache APIs
- detailed workings of apache modules
- security precautions
- apache in relation to a specific linux distribution
Introduction (Slide Five)
- the topic at hand: apache 2.0
- how this hands-on lab will work
- build, configure latest apache 2.0 release on our linux laptops 2, 15 minute breaks
- workbook, which contains the a copy of slides you see and additional information such as notes, comments and resources that further illuminate the topic at hand.
- with 3 hours to spare, feel free to stop and ask questions.
- how this hands-on lab will work
Apache 2.0: A History (Slide Six)
"history is the version of past events that people have decided to agree upon"
-Napoleon Bonaparte
Apache 2.0: A History (Slide Seven)
- plans for apache 2.0 date as far back as the summer of 1996
Apache 2.0: A History (Slide Eight)
- in june 1997 an official set of requirements for rewriting the core apache code was put forth some of the issues discussed at the time included:
- portability
- scalability
- configuration
- I/O processing
Apache 2.0: A History (Slide Nine)
- in june 1998 the apache core developers met for the first time to discuss the organizational structure of the apache group as well
Apache 2.0: A History (Slide Ten)
- in january 2000, 2.0 became the primary development branch for the apache web server
Apache 2.0: A History (Slide Eleven)
-
the first apache 2.0 alpha was launched at the apachecon 2000 conference in march 2000
Apache 2.0: A History (Slide Twelve)
- the first apache 2.0 beta was launched at the apacheCon 2001 conference in march 2001
Apache 2.0: A History (Slide Thirteen)
- apache 2.0 "went gold" with the first general availability release of version 2.0.35 in april 2002
Apache 2.0: A History (Slide Fourteen)
- in november 2002, it was decided that development of new features would take place in a 2.1 development tree
Apache 2.0: A History (Slide Fifteen)
- as of jul 2004 the latest stable release of apache 2.0 is apache 2.0.50
- apache 2.0.50 was released on 1st of jul 2004
New and Improved (Slide Sixteen)
"but wait, there's more!"
-from any given infomercial
New and Improved (Slide Seventeen)
- new process support with multiple-processing modules (MPMs)
- options vary depending on platform
- on linux
- prefork
- prefork with threads (worker)
- perchild
New and Improved (Slide Eighteen)
- the Apache Portable Runtime (APR) was introduced as the abstraction layer that masks the call differences of various systems
- the modules' APIs has introduced several enhancements to provide more flexibility in handling callback routines and data structures
New and Improved (Slide Nineteen)
- I/O filtering
- one module can modify the results of another
- filters can be configured within the config file
- modules can add filters based on request
- the configuration file has changed
- read once and stored in memory
- easy to convert to XML
- divided into multiple files
New and Improved (Slide Twenty)
- apache 2.0 also supports the new internet protocol, IPv6
- the apache group's distribution of apache 2.0 now includes additional modules such as mod_ssl, mod_dav, mod_cgid
Getting Apache 2.0 (Slide Twenty One)
"it's rather like going to buy coke, complaining to the coca-cola company that the drink was too sour, then finding that your supermarket was adding lemon"
-"Vendor patches to Apache" Apache Week, 3rd March 2003
Getting Apache 2.0 (Slide Twenty Two)
- from linux distribution
- Gentoo
- Debian
- Red Hat
- S.u.S.E.
Getting Apache 2.0 (Slide Twenty Three)
- from apache.org
Getting Apache 2.0 (Slide Twenty Four)
"the last thing anyone in the apache community seems to want is to compromise apache's open-source roots and cause fragmentation of a web server that is extremely popular. at the same time, most distributors want to make money on the software and fine-tune it to run with their linux distributions. walking that fine line is no easy task"
-"Patching Apache" NewsFactor Network, 21st May 2003
Building Apache 2.0 (Slide Twenty Five)
"truly, you have a dizzying intellect"
"wait 'til I get going"
- exchange from The Princess Bride
Building Apache 2.0 (Slide Twenty Six)
- getting our bearings
- apache file layout
- no independent src/ directory
- docs, config files, sample cgi scripts and error documents reside in docs/ directory
- modules, os related items modules/ and os/ directories
- apache file layout
Building Apache 2.0 (Slide Twenty Seven)
- module-go-round:
- gone
- mod_auth_db
- mod_digest
- mod_log_agent
- mod_log_referer
- new
- mod_cache
- mod_auth_cgid
- mod_charset_lite
- mod_dav
- mod_deflate
- mod_ext_filter
- mod_file_cache
- mod_isapi
- mod_ssl
- mod_suexec
Building Apache 2.0 (Slide Twenty Eight)
-
- server path is: /usr/local/apache2
- modules as listed with ./httpd -l
- core.c
- mod_access.c
- mod_auth.c
- mod_include.c
- mod_log_config.c
- mod_env.c
- mod_setenvif.c
- prefork.c
- http_core.c
- mod_mime.c
- mod_status.c
- mod_autoindex.c
- mod_asis.c
- mod_cgi.c
- mod_negotiation.c
- mod_dir.c
- mod_imap.c
- mod_actions.c
- mod_userdir.c
- mod_alias.c
./configure with no options:
Building Apache 2.0 (Slide Twenty Nine)
- some additional options for --configure
--enable-auth-digest
--enable-echo
--enable-mem-cache
--enable-case-filter
--enable-auth-ldap
--enable-usertrack
--enable-unique-id
--enable-proxy
--enable-info
--enable-vhost-alias
--enable-speling
--enable-rewrite
Building Apache 2.0 (Slide Thirty)
- dynamic or static modules
DSO capability
--enable-so
Building Apache 2.0 (Slide Thirty One)
./configure --prefix=/usr/local/apache-2.0.50 --enable-so=yes
make
sudo make install
Internission (Slide Thirty Two)
15 minutes while everyone's system run build processes
Configuring Apache 2.0 (Slide Thirty Three)
"i am extraordinarily patient, provided I get my own way in the end"
- Margaret Thatcher
Configuring Apache 2.0 (Slide Thirty Four)
- getting our bearings
- apache file layout
-
bin/
cgi-bin/
error/
icons/
lib/
man/
modules/
build/
conf/
htdocs/
include/
logs/
manual/
- apache file layout
Configuring Apache 2.0 (Slide Thirty Five)
- global environment configuration
- this section has seen a large number of changes compared with apache 1.3
Configuring Apache 2.0 (Slide Thirty Six)
- global environment configuration
- The prefork MPM accepts the same directives as apache 1.3
- StartServers
- MinSpareServers
- MaxSpareServers
- MaxClients
- MaxRequestsPerChild
- The prefork MPM accepts the same directives as apache 1.3
Configuring Apache 2.0 (Slide Thirty Seven)
- global environment configuration
- the BindAddress and Port directives no longer exist
- their functionality is now provided by a more flexible Listen and ServerName directives.
- the BindAddress and Port directives no longer exist
Configuring Apache 2.0 (Slide Thirty Eight)
- global environment configuration
- the AddModule and ClearModuleList directives no longer exist
- the order of the LoadModule lines is no longer relevant
Configuring Apache 2.0 (Slide Thirty Nine)
- global environment configuration
- gone missing
- ServerType
- AccessConfig
- ResourceConfig
- gone missing
Configuring Apache 2.0 (Slide Forty)
- main server configuration
- the section has seen little change between apache 1.3 and 2.0
- this is not by chance, but design
Configuring Apache 2.0 (Slide Forty One)
- main server configuration
- logging
- the following logging directives have been removed
- AgentLog
- RefererLog
- RefererIgnore
- agent and referrer logs are still available using the CustomLog and LogFormat directives
- the following logging directives have been removed
- logging
Configuring Apache 2.0 (Slide Forty Two)
- main server configuration
- directory indexing
- FancyIndexing directive has now been removed
- the new VersionSort option to the IndexOptions directive causes files containing version numbers to be sorted in a more natural way
- the defaults for the ReadmeName and HeaderName directives have changed from README and HEADER to README.html and HEADER.html
- directory indexing
Configuring Apache 2.0 (Slide Forty Three)
- main server configuration
- content negotiation
- the CacheNegotiatedDocs directive now takes the argument on or off
- content negotiation
Configuring Apache 2.0 (Slide Forty Four)
- main server configuration
- error documents
- to use a hard-coded message with the ErrorDocument directive, the message should be enclosed in a pair of double quotation marks
- greater flexibility with error documents
- error documents
Configuring Apache 2.0 (Slide Forty Five)
- virtual hosts configuration
- the contents of all containers should be migrated in the same way as the main server section
Configuring Apache 2.0 (Slide Forty Six)
- covalent script:
- http://apache.covalent.net/tools/index.php
- (local copy:http://http://www.weinstein.org/work/presentations/linuxworld/convconf.txt)
- example conversion of a "in production" apache 1.3.27 httpd.conf file
Modules Galore 2.0 (Slide Forty Seven)
"any sufficiently advanced technology is indistinguishable from magic
-Arthur C. Clarke
Modules Galore 2.0 (Slide Forty Eight)
- hooks and optional functions
- a hook represents an event that occurs in the course a connection
- modules can register to participate in various hooks, indicating that they wish to have callback functions run during those stages of request processing
Modules Galore 2.0 (Slide Forty Nine)
- hooks and optional functions
- optional functions allow a module to register a function for use by another module with the core
- if another module is interested in one of the registered functions, it checks with the core, retrieving a pointer to it if so
Modules Galore 2.0 (Slide Fifty)
- hooks and optional functions
- the benefits of this system are nicely illustrated in mod_include, which handles all of its SSI tags through an optional function
Modules Galore 2.0 (Slide Fifty One)
- filters
- chain actions on input or output, not connection events
Modules Galore 2.0 (Slide Fifty Two)
- filters
- example: Common Gateway Interface (CGI) scripts can generate server-parsed HTML documents which can then be processed by mod_include
- the way this works is that each request is served by exactly one handler module followed by zero or more filter modules
Modules Galore 2.0 (Slide Fifty Three)
- beginning with apache 2.0.42 the API will be kept stable
- third party modules, php example
-
./configure ---with-apxs2=/usr/local/apache-2.0.50/bin/apxs --prefix=/usr/local/apache-2.0.50/php-4.3.8 --disable-cgi
Intermission (Slide Fifty Four)
15 minutes while everyone's system run build processes
Modules Galore 2.0 (Slide Fifty Five)
- adding in PHP
-
LoadModule php4_module modules/libphp4.so
DirectoryIndex index.html index.php
AddType application/x-httpd-php php
Fine Tuning Apache 2.0 (Slide Fifty Six)
"perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away"
-Antoine de Sain
Fine Tuning Apache 2.0 (Slide Fifty Seven)
- MPM
- best linux option: prefork
- too early
- third party modules, the source of apache's success, may not be threads aware
- processing model is understood
- other MPMs options in future
- threading adds a bit of instability, even apache hybrid solution
- threading probably won't provide large benefit for linux systems anyway
- too early
- best linux option: prefork
Fine Tuning Apache 2.0 (Slide Fifty Eight)
- apache
- keep an eye on invoking resource intensive configurations
- HostNameLookup
- FollowSysLinks
- KeepAlive, KeepAliveTimeout, MaxKeepAlive
- Log level option
- session tracking
- .htacess files, large httpd.conf files
- modules such as
- mod_status
- mod_rewrite
- keep an eye on invoking resource intensive configurations
Fine Tuning Apache 2.0 (Slide Fifty Nine)
- linux
- kernel
- handle number processes/threads
- filesystem
- optimize block size
- enable journaling
- kernel
Fine Tuning Apache 2.0 (Slide Sixty)
- apache
- use apache bench for testing
-
- 5,000 request, 500 at a time, using KeepAlive requests to our local server
./ab -n5000 -c 500 -k localhost/
-
- use apache bench for testing
The Road Ahead (Slide Sixty One)
for a successful technology, reality must take precedence over public relations, for nature cannot be fooled"
-Richard Feynman
The Road Ahead (Slide Sixty Two)
usage of apache 2.0.x
The Road Ahead (Slide Sixty Three)
usage of apache 1.3.x
The Road Ahead (Slide Sixty Four)
- possible road blocks to adoption:
- lack of support
- hosting companies, modules
- "if it ain't broke don't fix it"
- lack of support
The Road Ahead (Slide Sixty Five)
history of apache releases
The Road Ahead (Slide Sixty Six)
- what's next for apache?
- 2.1 developments
- redesign of the MPMs code
- redesign of AAA (authentication/authorization/access control) code
- 2.1 developments
Review (Slide Sixty Seven)
- what was covered
- what is apache 2.0
- building, configuring
- running, troubleshooting
This Presentations (Slide Sixty Eight)
