apache2_config

June 22, 2026 ยท View on GitHub

Back to resource list

Renders the primary Apache configuration file. The defaults are tuned for secure, persistent HTTP serving:

  • Timeout 60
  • KeepAliveTimeout 2
  • MaxKeepAliveRequests 1000

Properties

nameTypeDefaultDescription
root_groupStringnode['root_group']Group that the root user on the box runs as. Defaults to platform specific value from ohai root_group
access_file_nameString.htaccessAccess filename
log_dirStringdefault_log_dirLog directory location. Defaults to platform specific locations, see libraries/helpers.rb
error_logStringdefault_error_logError log location. Defaults to platform specific locations, see libraries/helpers.rb
log_levelStringwarnLog level for apache2
apache_userStringdefault_apache_userSet to override the default apache2 user. Defaults to platform specific locations, see libraries/helpers.rb
apache_groupStringdefault_apache_groupSet to override the default apache2 user. Defaults to platform specific locations, see libraries/helpers.rb
keep_aliveStringOnPersistent connection feature of HTTP/1.1 provide long-lived HTTP sessions
max_keep_alive_requestsInteger1000MaxKeepAliveRequests
keep_alive_timeoutInteger2KeepAliveTimeout
docroot_dirStringdefault_docroot_dirApache document root. Defaults to platform specific locations, see libraries/helpers.rb
timeoutInteger, String60The number of seconds before receives and sends time out
server_nameStringlocalhostSets the ServerName directive
run_dirStringdefault_run_dirSets the DefaultRuntimeDir directive. Defaults to platform specific locations, see libraries/helpers.rb'
template_cookbookStringapache2Cookbook to source the template file from

Examples

  apache2_config 'apache2.conf' do
    access_file_name
    log_dir '/var/log/httpd/super_error_log'
    error_log '/var/log/httpd/super_error_log'
    log_level 'error'
    apache_user 'superApacheUser'
    apache_group 'superApacheUser'
    keep_alive 'On'
    max_keep_alive_requests 15
    keep_alive_timeout 100
    docroot_dir '/var/www/serverRootDir'
    timeout 60
    server_name '127.0.0.1'
  end