Building a Web Server, a Step-by-Step Instruction Guide
httpd.conf -- Linux
Listen 80
ServerRoot /usr/local/apache2
DocumentRoot /usr/local/webroot
ServerName localhost:80
ServerAdmin admin@localhost
ServerSignature On
ServerTokens Full
DefaultType text/plain
AddDefaultCharset ISO-8859-1
UseCanonicalName Off
HostnameLookups Off
ErrorLog logs/error_log
LogLevel warn
PidFile logs/httpd.pid
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 15
User nobody
Group nobody
<IfModule prefork.c>
MaxClients 150
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxRequestsPerChild 0
</IfModule>
<IfModule worker.c>
StartServers 2
MaxClients 150
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestsPerChild 0
</IfModule>
LoadModule access_module modules/mod_access.so
LoadModule deflate_module modules/mod_deflate.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule headers_module modules/mod_headers.so
LoadModule setenvif_module modules/mod_setenvif.so
<IfDefine SSL>
LoadModule ssl_module modules/mod_ssl.so
</IfDefine>
LoadModule mime_module modules/mod_mime.so
LoadModule status_module modules/mod_status.so
LoadModule info_module modules/mod_info.so
LoadModule dir_module modules/mod_dir.so
LoadModule php4_module modules/libphp4.so
<Location />
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/css
<IfModule mod_headers.c>
Header append Vary User-Agent
</IfModule>
</IfModule>
</Location>
<Directory />
Options FollowSymLinks
AllowOverride None
order allow,deny
deny from all
</Directory>
<Directory "/usr/local/webroot">
order allow,deny
allow from all
</Directory>
<IfModule mod_log_config.c>
LogFormat "%h %l %u %t /"%r/" %>s %b /"%{Referer}i/" /"%{User-agent}i/"" combined
CustomLog logs/access_log combined
<IfModule mod_deflate.c>
DeflateFilterNote Input instream
DeflateFilterNote Output outstream
DeflateFilterNote Ratio ratio
LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate
CustomLog logs/deflate_log deflate
</IfModule>
</IfModule>
<IfModule mod_dir.c>
DirectoryIndex index.html index.php
</IfModule>
<IfModule mod_mime.c>
TypesConfig conf/mime.types
AddType application/x-tar .tgz
AddType application/x-rar-compressed .rar
<IfModule sapi_apache2.c>
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
</IfModule>
</IfModule>
<IfModule mod_setenvif.c>
BrowserMatch "Mozilla/2" nokeepalive
BrowserMatch "MSIE 4/.0b2;" nokeepalive downgrade-1.0 force-response-1.0
BrowserMatch "RealPlayer 4/.0" force-response-1.0
BrowserMatch "Java/1/.0" force-response-1.0
BrowserMatch "JDK/1/.0" force-response-1.0
BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully
BrowserMatch "^WebDrive" redirect-carefully
BrowserMatch "^WebDAVFS/1.[012]" redirect-carefully
BrowserMatch "^gnome-vfs" redirect-carefully
<IfModule mod_deflate.c>
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4/.0[678] no-gzip
BrowserMatch /bMSIE !no-gzip !gzip-only-text/html
</IfModule>
</IfModule>
<IfModule mod_status.c>
ExtendedStatus On
<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Location>
</IfModule>
<IfModule mod_info.c>
<Location /server-info>
SetHandler server-info
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Location>
</IfModule>
<IfModule mod_ssl.c>
Include conf/ssl.conf
</IfModule>