Apache HTTP Server 2.2: By, Ahmed Medhat
Apache HTTP Server 2.2: By, Ahmed Medhat
Introduction
Apache HTTP Server is a project from Apache Software Foundation a.k.a HTTPD
Installation
Super easy on GNU/Linux, Unix.. On RedHat derivatives
yum install httpd service httpd start
Configuration
/etc/httpd/conf/httpd.conf Important directives:
DocumentRoot (where to serve content) Listen (bind on which socket (ip:port)) LogLevel (debug,info,notice,warn,error,crit,alert,emerg) DirectoryIndex (default directory index page)
Multi-Processing Module
Respecting modularity, you can control the most basic functions of the web server. Responsible for:
Binding to network ports Accepting requests Dispatching request handling children.
Available MPM
Worker (POSIX) Prefork (POSIX) Mpm_winnt (for windows) *wont talk about, Unix biased :)
POSIX = Portable Operating System Interface for Unix
Prefork MPM
Old Apache 1.3 only MPM Non-threaded, for sake of respect to nonthread safe libraries Single process/thread, many child, one process rule them all Resource hungry, Listener process embedded Lots of tuning, expandability needs reconfiguration
Worker MPM
Hybrid multi-process multi-threaded server Many threads, Many requests, Few resources Retains stability by having many processes, each with many threads Respects memory, GC Listener process, The guarding angel process
Sample Request
Virtual Hosts
A blessing for business Many web sites -> one web-server
GET /hello.html HTTP/1.1
Host: www.example.com
Sample configuration
<VirtualHost *:80> ServerAdmin [email protected] DocumentRoot /var/www/example.com ServerName example.com ServerAlias www.example.com ErrorLog logs/example.com-error_log CustomLog logs/example.com-access_log common </VirtualHost>
Thank you
Questions ?