Here are two quick snippets of the minimal set of directives to launch an httpd instance for versions 2.4 and 2.2.

They are meant to be used as a starting point when one either wants to clean up an old instance which segfaults or suffers from other recurring issues, or to achieve the minimum footprint on a system with limited resources.

Configurations presume you have your Apache web server, including configuration, modules and documents to serve, installed in /usr/httpd/. For common locations for these things in many distributions look at this page http://wiki.apache.org/httpd/DistrosDefaultLayout. Configurations also presume all possible modules are compiled as dynamically loadable as opposed to static.

The following configuration is compatible with version 2.4 of the Apache HTTP server with the default MPM (event) compiled as a shared module.

# Apache httpd v2.4 minimal configuration
# This can be reduced further if you remove the accees log and mod_log_config
ServerRoot "/usr/httpd"

# Minimum modules needed
LoadModule mpm_event_module modules/mod_mpm_event.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module modules/mod_mime.so
LoadModule dir_module modules/mod_dir.so
LoadModule authz_core_module modules/mod_authz_core.so
LoadModule unixd_module modules/mod_unixd.so

TypesConfig conf/mime.types

PidFile logs/httpd.pid

# Comment this out if running httpd as a non root user
User nobody

# Port to Listen on
Listen *:8080

# In a basic setup httpd can only serve files from its document root
DocumentRoot "/usr/httpd/htdocs"

# Default file to serve
DirectoryIndex index.html

# Errors go to their own log
ErrorLog logs/error_log

# Access log
LogFormat "%h %l %u %t \"%r\" %>s %b" common
CustomLog logs/access_log common

# Never change this block
<Directory />
  AllowOverride None
  Require all denied
</Directory>

# Allow documents to be served from the DocumentRoot
<Directory "/usr/httpd/htdocs">
  Require all granted
</Directory>

The following configuration is compatible with version 2.2 of the Apache HTTP server.

# Apache httpd v2.2 minimal configuration
# This can be reduced further if you remove the access log and mod_log_config
ServerRoot "/usr/httpd"

# Minimum modules needed
LoadModule log_config_module modules/mod_log_config.so
LoadModule dir_module modules/mod_dir.so
LoadModule mime_module modules/mod_mime.so
LoadModule authz_host_module modules/mod_authz_host.so

TypesConfig conf/mime.types

PidFile logs/httpd.pid

# Comment this out if running httpd as a non root user
User nobody

# Port to Listen on
Listen *:8080

# In a basic setup httpd can only serve files from its document root
DocumentRoot "/usr/httpd/htdocs"

# Default file to serve
DirectoryIndex index.html

# Errors go to their own log
ErrorLog logs/error_log

# Access log
LogFormat "%h %l %u %t \"%r\" %>s %b" common
CustomLog logs/access_log common

# Never change this block
<Directory />
  AllowOverride None
  Deny from all
</Directory>

# Allow documents to be served from the DocumentRoot
<Directory /usr/httpd/htdocs>
  Allow from all
</Directory>

The following configuration is compatible with version 2.4 of the Apache HTTP server on Microsoft windows.

ServerRoot "C:/Program Files/Apache httpd 2.4"

# Minimum modules needed
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module modules/mod_mime.so
LoadModule dir_module modules/mod_dir.so
LoadModule authz_core_module modules/mod_authz_core.so

TypesConfig conf/mime.types

PidFile logs/httpd.pid

# Port to Listen on
Listen *:8080

# In a basic setup httpd can only serve files from its document root
DocumentRoot "C:/Program Files/Apache httpd 2.4"

# Default file to serve
DirectoryIndex index.html

# Errors go to their own log
ErrorLog logs/error_log

# Access log
LogFormat "%h %l %u %t \"%r\" %>s %b" common
CustomLog logs/access_log common

# Never change this block
<Directory />
  AllowOverride None
  Require all denied
</Directory>

# Allow documents to be served from the DocumentRoot
<Directory "C:/Program Files/Apache httpd 2.4/htdocs">
  Options Indexes FollowSymLinks
  AllowOverride None
  Require all granted
<Directory>
  • No labels