Differences between revisions 4 and 5
Revision 4 as of 2016-05-26 12:51:56
Size: 2574
Editor: SeanTimmins
Comment: Updated and added comments
Revision 5 as of 2016-05-26 14:20:26
Size: 3304
Editor: SeanTimmins
Comment: mime.type to conf directory and use modules instead of lib. Also added access log
Deletions are marked like this. Additions are marked like this.
Line 11: Line 11:
# This can be reduced further if you remove the accees log and mod_log_config
Line 14: Line 15:
LoadModule mpm_event_module lib/mod_mpm_event.so
LoadModule mime_module lib/mod_mime.so
LoadModule dir_module lib
/mod_dir.so
LoadModule authz_core_module lib/mod_authz_core.so
LoadModule unixd_module lib/mod_unixd.so
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
Line 20: Line 22:
TypesConfig /usr/httpd/etc/mime.types TypesConfig conf/mime.types
Line 30: Line 32:
# In a basic setup httpd can only serve files from its document root
Line 31: Line 34:

# Default file to serve
Line 32: Line 37:
ErrorLog syslog
# 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
Line 50: Line 61:
# This can be reduced further if you remove the access log and mod_log_config
Line 53: Line 65:
LoadModule dir_module lib/httpd/mod_dir.so
LoadModule mime_module lib/httpd/mod_mime.so
LoadModule authz_host_module lib/httpd/mod_authz_host.so
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
Line 57: Line 70:
TypesConfig /usr/httpd/etc/mime.types TypesConfig conf/mime.types
Line 67: Line 80:
# In a basic setup httpd can only serve files from its document root
Line 68: Line 82:

# Default file to serve
Line 69: Line 85:
ErrorLog syslog
# 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

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. This configuration will need to be modified slightly for windows installs.

# 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>

Minimal_Config (last edited 2016-05-26 14:20:26 by SeanTimmins)