Saltstack Official Apache Formula
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

242 lines
8.3KB

  1. #
  2. # Based upon the NCSA server configuration files originally by Rob McCool.
  3. #
  4. # This is the main Apache server configuration file. It contains the
  5. # configuration directives that give the server its instructions.
  6. # See http://httpd.apache.org/docs/2.2/ for detailed information about
  7. # the directives.
  8. #
  9. # Do NOT simply read the instructions in here without understanding
  10. # what they do. They're here only as hints or reminders. If you are unsure
  11. # consult the online docs. You have been warned.
  12. #
  13. # The configuration directives are grouped into three basic sections:
  14. # 1. Directives that control the operation of the Apache server process as a
  15. # whole (the 'global environment').
  16. # 2. Directives that define the parameters of the 'main' or 'default' server,
  17. # which responds to requests that aren't handled by a virtual host.
  18. # These directives also provide default values for the settings
  19. # of all virtual hosts.
  20. # 3. Settings for virtual hosts, which allow Web requests to be sent to
  21. # different IP addresses or hostnames and have them handled by the
  22. # same Apache server process.
  23. #
  24. # Configuration and logfile names: If the filenames you specify for many
  25. # of the server's control files begin with "/" (or "drive:/" for Win32), the
  26. # server will use that explicit path. If the filenames do *not* begin
  27. # with "/", the value of ServerRoot is prepended -- so "foo.log"
  28. # with ServerRoot set to "/etc/apache2" will be interpreted by the
  29. # server as "/etc/apache2/foo.log".
  30. #
  31. ### Section 1: Global Environment
  32. #
  33. # The directives in this section affect the overall operation of Apache,
  34. # such as the number of concurrent requests it can handle or where it
  35. # can find its configuration files.
  36. #
  37. #
  38. # ServerRoot: The top of the directory tree under which the server's
  39. # configuration, error, and log files are kept.
  40. #
  41. # NOTE! If you intend to place this on an NFS (or otherwise network)
  42. # mounted filesystem then please read the LockFile documentation (available
  43. # at <URL:http://httpd.apache.org/docs/2.2/mod/mpm_common.html#lockfile>);
  44. # you will save yourself a lot of trouble.
  45. #
  46. # Do NOT add a slash at the end of the directory path.
  47. #
  48. #ServerRoot "/etc/apache2"
  49. #
  50. # The accept serialization lock file MUST BE STORED ON A LOCAL DISK.
  51. #
  52. LockFile ${APACHE_LOCK_DIR}/accept.lock
  53. #
  54. # PidFile: The file in which the server should record its process
  55. # identification number when it starts.
  56. # This needs to be set in /etc/apache2/envvars
  57. #
  58. PidFile ${APACHE_PID_FILE}
  59. #
  60. # Timeout: The number of seconds before receives and sends time out.
  61. #
  62. Timeout 300
  63. #
  64. # KeepAlive: Whether or not to allow persistent connections (more than
  65. # one request per connection). Set to "Off" to deactivate.
  66. #
  67. KeepAlive {{ salt['pillar.get']('apache:keepalive', 'On') }}
  68. #
  69. # MaxKeepAliveRequests: The maximum number of requests to allow
  70. # during a persistent connection. Set to 0 to allow an unlimited amount.
  71. # We recommend you leave this number high, for maximum performance.
  72. #
  73. MaxKeepAliveRequests 100
  74. #
  75. # KeepAliveTimeout: Number of seconds to wait for the next request from the
  76. # same client on the same connection.
  77. #
  78. KeepAliveTimeout 5
  79. ##
  80. ## Server-Pool Size Regulation (MPM specific)
  81. ##
  82. # prefork MPM
  83. # StartServers: number of server processes to start
  84. # MinSpareServers: minimum number of server processes which are kept spare
  85. # MaxSpareServers: maximum number of server processes which are kept spare
  86. # MaxClients: maximum number of server processes allowed to start
  87. # MaxRequestsPerChild: maximum number of requests a server process serves
  88. <IfModule mpm_prefork_module>
  89. StartServers 5
  90. MinSpareServers 5
  91. MaxSpareServers 10
  92. MaxClients 150
  93. MaxRequestsPerChild 0
  94. </IfModule>
  95. # worker MPM
  96. # StartServers: initial number of server processes to start
  97. # MinSpareThreads: minimum number of worker threads which are kept spare
  98. # MaxSpareThreads: maximum number of worker threads which are kept spare
  99. # ThreadLimit: ThreadsPerChild can be changed to this maximum value during a
  100. # graceful restart. ThreadLimit can only be changed by stopping
  101. # and starting Apache.
  102. # ThreadsPerChild: constant number of worker threads in each server process
  103. # MaxClients: maximum number of simultaneous client connections
  104. # MaxRequestsPerChild: maximum number of requests a server process serves
  105. <IfModule mpm_worker_module>
  106. StartServers 2
  107. MinSpareThreads 25
  108. MaxSpareThreads 75
  109. ThreadLimit 64
  110. ThreadsPerChild 25
  111. MaxClients 150
  112. MaxRequestsPerChild 0
  113. </IfModule>
  114. # event MPM
  115. # StartServers: initial number of server processes to start
  116. # MinSpareThreads: minimum number of worker threads which are kept spare
  117. # MaxSpareThreads: maximum number of worker threads which are kept spare
  118. # ThreadsPerChild: constant number of worker threads in each server process
  119. # MaxClients: maximum number of simultaneous client connections
  120. # MaxRequestsPerChild: maximum number of requests a server process serves
  121. <IfModule mpm_event_module>
  122. StartServers 2
  123. MinSpareThreads 25
  124. MaxSpareThreads 75
  125. ThreadLimit 64
  126. ThreadsPerChild 25
  127. MaxClients 150
  128. MaxRequestsPerChild 0
  129. </IfModule>
  130. # These need to be set in /etc/apache2/envvars
  131. User ${APACHE_RUN_USER}
  132. Group ${APACHE_RUN_GROUP}
  133. #
  134. # AccessFileName: The name of the file to look for in each directory
  135. # for additional configuration directives. See also the AllowOverride
  136. # directive.
  137. #
  138. AccessFileName .htaccess
  139. #
  140. # The following lines prevent .htaccess and .htpasswd files from being
  141. # viewed by Web clients.
  142. #
  143. <Files ~ "^\.ht">
  144. Order allow,deny
  145. Deny from all
  146. Satisfy all
  147. </Files>
  148. #
  149. # DefaultType is the default MIME type the server will use for a document
  150. # if it cannot otherwise determine one, such as from filename extensions.
  151. # If your server contains mostly text or HTML documents, "text/plain" is
  152. # a good value. If most of your content is binary, such as applications
  153. # or images, you may want to use "application/octet-stream" instead to
  154. # keep browsers from trying to display binary files as though they are
  155. # text.
  156. #
  157. # It is also possible to omit any default MIME type and let the
  158. # client's browser guess an appropriate action instead. Typically the
  159. # browser will decide based on the file's extension then. In cases
  160. # where no good assumption can be made, letting the default MIME type
  161. # unset is suggested instead of forcing the browser to accept
  162. # incorrect metadata.
  163. #
  164. DefaultType None
  165. #
  166. # HostnameLookups: Log the names of clients or just their IP addresses
  167. # e.g., www.apache.org (on) or 204.62.129.132 (off).
  168. # The default is off because it'd be overall better for the net if people
  169. # had to knowingly turn this feature on, since enabling it means that
  170. # each client request will result in AT LEAST one lookup request to the
  171. # nameserver.
  172. #
  173. HostnameLookups Off
  174. # ErrorLog: The location of the error log file.
  175. # If you do not specify an ErrorLog directive within a <VirtualHost>
  176. # container, error messages relating to that virtual host will be
  177. # logged here. If you *do* define an error logfile for a <VirtualHost>
  178. # container, that host's errors will be logged there and not here.
  179. #
  180. ErrorLog ${APACHE_LOG_DIR}/error.log
  181. #
  182. # LogLevel: Control the number of messages logged to the error_log.
  183. # Possible values include: debug, info, notice, warn, error, crit,
  184. # alert, emerg.
  185. #
  186. LogLevel warn
  187. # Include module configuration:
  188. Include mods-enabled/*.load
  189. Include mods-enabled/*.conf
  190. # Include all the user configurations:
  191. Include httpd.conf
  192. # Include ports listing
  193. Include ports.conf
  194. #
  195. # The following directives define some format nicknames for use with
  196. # a CustomLog directive (see below).
  197. # If you are behind a reverse proxy, you might want to change %h into %{X-Forwarded-For}i
  198. #
  199. LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
  200. LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
  201. LogFormat "%h %l %u %t \"%r\" %>s %O" common
  202. LogFormat "%{Referer}i -> %U" referer
  203. LogFormat "%{User-agent}i" agent
  204. {%- for directive, dvalue in salt['pillar.get']('apache:global', {}).items() %}
  205. {{ directive }} {{ dvalue }}
  206. {%- endfor %}
  207. # Include of directories ignores editors' and dpkg's backup files,
  208. # see README.Debian for details.
  209. # Include generic snippets of statements
  210. Include conf.d/
  211. # Include the virtual host configurations:
  212. Include sites-enabled/