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.

433 lines
15KB

  1. #
  2. # This is the main Apache HTTP server configuration file. It contains the
  3. # configuration directives that give the server its instructions.
  4. # See <URL:http://httpd.apache.org/docs/2.4/> for detailed information.
  5. # In particular, see
  6. # <URL:http://httpd.apache.org/docs/2.4/mod/directives.html>
  7. # for a discussion of each configuration directive.
  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. # Configuration and logfile names: If the filenames you specify for many
  14. # of the server's control files begin with "/" (or "drive:/" for Win32), the
  15. # server will use that explicit path. If the filenames do *not* begin
  16. # with "/", the value of ServerRoot is prepended -- so 'log/access_log'
  17. # with ServerRoot set to '/www' will be interpreted by the
  18. # server as '/www/log/access_log', where as '/log/access_log' will be
  19. # interpreted as '/log/access_log'.
  20. #
  21. # ServerRoot: The top of the directory tree under which the server's
  22. # configuration, error, and log files are kept.
  23. #
  24. # Do not add a slash at the end of the directory path. If you point
  25. # ServerRoot at a non-local disk, be sure to specify a local disk on the
  26. # Mutex directive, if file-based mutexes are used. If you wish to share the
  27. # same ServerRoot for multiple httpd daemons, you will need to change at
  28. # least PidFile.
  29. #
  30. ServerRoot "{{ apache.get('serverroot', '/etc/httpd') }}"
  31. #
  32. # Listen: Allows you to bind Apache to specific IP addresses and/or
  33. # ports, instead of the default. See also the <VirtualHost>
  34. # directive.
  35. #
  36. # Change this to Listen on specific IP addresses as shown below to
  37. # prevent Apache from glomming onto all bound IP addresses.
  38. #
  39. #Listen 12.34.56.78:80
  40. Listen 80
  41. #
  42. # Dynamic Shared Object (DSO) Support
  43. #
  44. # To be able to use the functionality of a module which was built as a DSO you
  45. # have to place corresponding `LoadModule' lines at this location so the
  46. # directives contained in it are actually available _before_ they are used.
  47. # Statically compiled modules (those listed by `httpd -l') do not need
  48. # to be loaded here.
  49. #
  50. # Example:
  51. # LoadModule foo_module modules/mod_foo.so
  52. #
  53. LoadModule auth_basic_module modules/mod_auth_basic.so
  54. LoadModule auth_digest_module modules/mod_auth_digest.so
  55. LoadModule authn_file_module modules/mod_authn_file.so
  56. LoadModule authn_alias_module modules/mod_authn_alias.so
  57. LoadModule authn_anon_module modules/mod_authn_anon.so
  58. LoadModule authn_dbm_module modules/mod_authn_dbm.so
  59. LoadModule authn_default_module modules/mod_authn_default.so
  60. LoadModule authz_host_module modules/mod_authz_host.so
  61. LoadModule authz_user_module modules/mod_authz_user.so
  62. LoadModule authz_owner_module modules/mod_authz_owner.so
  63. LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
  64. LoadModule authz_dbm_module modules/mod_authz_dbm.so
  65. LoadModule authz_default_module modules/mod_authz_default.so
  66. LoadModule ldap_module modules/mod_ldap.so
  67. LoadModule authnz_ldap_module modules/mod_authnz_ldap.so
  68. LoadModule include_module modules/mod_include.so
  69. LoadModule log_config_module modules/mod_log_config.so
  70. LoadModule logio_module modules/mod_logio.so
  71. LoadModule env_module modules/mod_env.so
  72. LoadModule ext_filter_module modules/mod_ext_filter.so
  73. LoadModule mime_magic_module modules/mod_mime_magic.so
  74. LoadModule expires_module modules/mod_expires.so
  75. LoadModule deflate_module modules/mod_deflate.so
  76. LoadModule headers_module modules/mod_headers.so
  77. LoadModule usertrack_module modules/mod_usertrack.so
  78. LoadModule setenvif_module modules/mod_setenvif.so
  79. LoadModule mime_module modules/mod_mime.so
  80. LoadModule dav_module modules/mod_dav.so
  81. LoadModule status_module modules/mod_status.so
  82. LoadModule autoindex_module modules/mod_autoindex.so
  83. LoadModule info_module modules/mod_info.so
  84. LoadModule dav_fs_module modules/mod_dav_fs.so
  85. LoadModule vhost_alias_module modules/mod_vhost_alias.so
  86. LoadModule negotiation_module modules/mod_negotiation.so
  87. LoadModule dir_module modules/mod_dir.so
  88. LoadModule actions_module modules/mod_actions.so
  89. LoadModule speling_module modules/mod_speling.so
  90. LoadModule userdir_module modules/mod_userdir.so
  91. LoadModule alias_module modules/mod_alias.so
  92. LoadModule substitute_module modules/mod_substitute.so
  93. LoadModule rewrite_module modules/mod_rewrite.so
  94. LoadModule proxy_module modules/mod_proxy.so
  95. LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
  96. LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
  97. LoadModule proxy_http_module modules/mod_proxy_http.so
  98. LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
  99. LoadModule proxy_connect_module modules/mod_proxy_connect.so
  100. LoadModule cache_module modules/mod_cache.so
  101. LoadModule suexec_module modules/mod_suexec.so
  102. LoadModule disk_cache_module modules/mod_disk_cache.so
  103. LoadModule cgi_module modules/mod_cgi.so
  104. LoadModule version_module modules/mod_version.so
  105. #
  106. # The following modules are not loaded by default:
  107. #
  108. #LoadModule asis_module modules/mod_asis.so
  109. #LoadModule authn_dbd_module modules/mod_authn_dbd.so
  110. #LoadModule cern_meta_module modules/mod_cern_meta.so
  111. #LoadModule cgid_module modules/mod_cgid.so
  112. #LoadModule dbd_module modules/mod_dbd.so
  113. #LoadModule dumpio_module modules/mod_dumpio.so
  114. #LoadModule filter_module modules/mod_filter.so
  115. #LoadModule ident_module modules/mod_ident.so
  116. #LoadModule log_forensic_module modules/mod_log_forensic.so
  117. #LoadModule unique_id_module modules/mod_unique_id.so
  118. #LoadModule file_cache_module modules/mod_file_cache.so
  119. #
  120. # If you wish httpd to run as a different user or group, you must run
  121. # httpd as root initially and it will switch.
  122. #
  123. # User/Group: The name (or #number) of the user/group to run httpd as.
  124. # It is usually good practice to create a dedicated user and group for
  125. # running httpd, as with most system services.
  126. #
  127. User apache
  128. Group apache
  129. # 'Main' server configuration
  130. #
  131. # The directives in this section set up the values used by the 'main'
  132. # server, which responds to any requests that aren't handled by a
  133. # <VirtualHost> definition. These values also provide defaults for
  134. # any <VirtualHost> containers you may define later in the file.
  135. #
  136. # All of these directives may appear inside <VirtualHost> containers,
  137. # in which case these default settings will be overridden for the
  138. # virtual host being defined.
  139. #
  140. #
  141. # ServerAdmin: Your address, where problems with the server should be
  142. # e-mailed. This address appears on some server-generated pages, such
  143. # as error documents. e.g. admin@your-domain.com
  144. #
  145. ServerAdmin root@localhost
  146. #
  147. # ServerName gives the name and port that the server uses to identify itself.
  148. # This can often be determined automatically, but we recommend you specify
  149. # it explicitly to prevent problems during startup.
  150. #
  151. # If your host doesn't have a registered DNS name, enter its IP address here.
  152. #
  153. #ServerName www.example.com:80
  154. #
  155. # Deny access to the entirety of your server's filesystem. You must
  156. # explicitly permit access to web content directories in other
  157. # <Directory> blocks below.
  158. #
  159. <Directory />
  160. AllowOverride none
  161. Order deny,allow
  162. Deny from all
  163. </Directory>
  164. #
  165. # Note that from this point forward you must specifically allow
  166. # particular features to be enabled - so if something's not working as
  167. # you might expect, make sure that you have specifically enabled it
  168. # below.
  169. #
  170. #
  171. # DocumentRoot: The directory out of which you will serve your
  172. # documents. By default, all requests are taken from this directory, but
  173. # symbolic links and aliases may be used to point to other locations.
  174. #
  175. DocumentRoot "{{ apache.get('docroot', apache.wwwdir + '/html') }}"
  176. #
  177. # Relax access to content within {{ apache.wwwdir }}.
  178. #
  179. <Directory "{{ apache.wwwdir }}">
  180. AllowOverride None
  181. # Allow open access:
  182. Order allow,deny
  183. Allow from all
  184. </Directory>
  185. # Further relax access to the default document root:
  186. <Directory "{{ apache.get('docroot', apache.wwwdir + '/html') }}">
  187. #
  188. # Possible values for the Options directive are "None", "All",
  189. # or any combination of:
  190. # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
  191. #
  192. # Note that "MultiViews" must be named *explicitly* --- "Options All"
  193. # doesn't give it to you.
  194. #
  195. # The Options directive is both complicated and important. Please see
  196. # http://httpd.apache.org/docs/2.4/mod/core.html#options
  197. # for more information.
  198. #
  199. Options Indexes FollowSymLinks
  200. #
  201. # AllowOverride controls what directives may be placed in .htaccess files.
  202. # It can be "All", "None", or any combination of the keywords:
  203. # Options FileInfo AuthConfig Limit
  204. #
  205. AllowOverride None
  206. #
  207. # Controls who can get stuff from this server.
  208. #
  209. Order allow,deny
  210. Allow from all
  211. </Directory>
  212. #
  213. # DirectoryIndex: sets the file that Apache will serve if a directory
  214. # is requested.
  215. #
  216. <IfModule dir_module>
  217. DirectoryIndex index.html
  218. </IfModule>
  219. #
  220. # The following lines prevent .htaccess and .htpasswd files from being
  221. # viewed by Web clients.
  222. #
  223. <Files ".ht*">
  224. Order deny,allow
  225. Deny from all
  226. </Files>
  227. #
  228. # ErrorLog: The location of the error log file.
  229. # If you do not specify an ErrorLog directive within a <VirtualHost>
  230. # container, error messages relating to that virtual host will be
  231. # logged here. If you *do* define an error logfile for a <VirtualHost>
  232. # container, that host's errors will be logged there and not here.
  233. #
  234. ErrorLog "logs/error_log"
  235. #
  236. # LogLevel: Control the number of messages logged to the error_log.
  237. # Possible values include: debug, info, notice, warn, error, crit,
  238. # alert, emerg.
  239. #
  240. LogLevel warn
  241. <IfModule log_config_module>
  242. #
  243. # The following directives define some format nicknames for use with
  244. # a CustomLog directive (see below).
  245. #
  246. LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
  247. LogFormat "%h %l %u %t \"%r\" %>s %b" common
  248. {%- for log_format in salt['pillar.get']('apache:log_formats', []) %}
  249. LogFormat {{ log_format }}
  250. {%- endfor %}
  251. <IfModule logio_module>
  252. # You need to enable mod_logio.c to use %I and %O
  253. LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
  254. </IfModule>
  255. #
  256. # The location and format of the access logfile (Common Logfile Format).
  257. # If you do not define any access logfiles within a <VirtualHost>
  258. # container, they will be logged here. Contrariwise, if you *do*
  259. # define per-<VirtualHost> access logfiles, transactions will be
  260. # logged therein and *not* in this file.
  261. #
  262. #CustomLog "logs/access_log" common
  263. #
  264. # If you prefer a logfile with access, agent, and referer information
  265. # (Combined Logfile Format) you can use the following directive.
  266. #
  267. CustomLog "logs/access_log" combined
  268. </IfModule>
  269. <IfModule alias_module>
  270. #
  271. # Redirect: Allows you to tell clients about documents that used to
  272. # exist in your server's namespace, but do not anymore. The client
  273. # will make a new request for the document at its new location.
  274. # Example:
  275. # Redirect permanent /foo http://www.example.com/bar
  276. #
  277. # Alias: Maps web paths into filesystem paths and is used to
  278. # access content that does not live under the DocumentRoot.
  279. # Example:
  280. # Alias /webpath /full/filesystem/path
  281. #
  282. # If you include a trailing / on /webpath then the server will
  283. # require it to be present in the URL. You will also likely
  284. # need to provide a <Directory> section to allow access to
  285. # the filesystem path.
  286. #
  287. # ScriptAlias: This controls which directories contain server scripts.
  288. # ScriptAliases are essentially the same as Aliases, except that
  289. # documents in the target directory are treated as applications and
  290. # run by the server when requested rather than as documents sent to the
  291. # client. The same rules about trailing "/" apply to ScriptAlias
  292. # directives as to Alias.
  293. #
  294. ScriptAlias /cgi-bin/ "{{ apache.wwwdir }}/cgi-bin/"
  295. </IfModule>
  296. #
  297. # "{{ apache.wwwdir }}/cgi-bin/" should be changed to whatever your ScriptAliased
  298. # CGI directory exists, if you have that configured.
  299. #
  300. <Directory "{{ apache.wwwdir }}/cgi-bin/">
  301. AllowOverride None
  302. Options None
  303. Order allow,deny
  304. Allow from all
  305. </Directory>
  306. <IfModule mime_module>
  307. #
  308. # TypesConfig points to the file containing the list of mappings from
  309. # filename extension to MIME-type.
  310. #
  311. TypesConfig /etc/mime.types
  312. #
  313. # AddType allows you to add to or override the MIME configuration
  314. # file specified in TypesConfig for specific file types.
  315. #
  316. #AddType application/x-gzip .tgz
  317. #
  318. # AddEncoding allows you to have certain browsers uncompress
  319. # information on the fly. Note: Not all browsers support this.
  320. #
  321. #AddEncoding x-compress .Z
  322. #AddEncoding x-gzip .gz .tgz
  323. #
  324. # If the AddEncoding directives above are commented-out, then you
  325. # probably should define those extensions to indicate media types:
  326. #
  327. AddType application/x-compress .Z
  328. AddType application/x-gzip .gz .tgz
  329. #
  330. # AddHandler allows you to map certain file extensions to "handlers":
  331. # actions unrelated to filetype. These can be either built into the server
  332. # or added with the Action directive (see below)
  333. #
  334. # To use CGI scripts outside of ScriptAliased directories:
  335. # (You will also need to add "ExecCGI" to the "Options" directive.)
  336. #
  337. #AddHandler cgi-script .cgi
  338. # For type maps (negotiated resources):
  339. #AddHandler type-map var
  340. #
  341. # Filters allow you to process content before it is sent to the client.
  342. #
  343. # To parse .shtml files for server-side includes (SSI):
  344. # (You will also need to add "Includes" to the "Options" directive.)
  345. #
  346. AddType text/html .shtml
  347. AddOutputFilter INCLUDES .shtml
  348. </IfModule>
  349. #
  350. # Specify a default charset for all content served; this enables
  351. # interpretation of all content as UTF-8 by default. To use the
  352. # default browser choice (ISO-8859-1), or to allow the META tags
  353. # in HTML content to override this choice, comment out this
  354. # directive:
  355. #
  356. AddDefaultCharset UTF-8
  357. <IfModule mime_magic_module>
  358. #
  359. # The mod_mime_magic module allows the server to use various hints from the
  360. # contents of the file itself to determine its type. The MIMEMagicFile
  361. # directive tells the module where the hint definitions are located.
  362. #
  363. MIMEMagicFile conf/magic
  364. </IfModule>
  365. #
  366. # Customizable error responses come in three flavors:
  367. # 1) plain text 2) local redirects 3) external redirects
  368. #
  369. # Some examples:
  370. #ErrorDocument 500 "The server made a boo boo."
  371. #ErrorDocument 404 /missing.html
  372. #ErrorDocument 404 "/cgi-bin/missing_handler.pl"
  373. #ErrorDocument 402 http://www.example.com/subscription_info.html
  374. #
  375. #
  376. # EnableMMAP and EnableSendfile: On systems that support it,
  377. # memory-mapping or the sendfile syscall may be used to deliver
  378. # files. This usually improves server performance, but must
  379. # be turned off when serving from networked-mounted
  380. # filesystems or if support for these functions is otherwise
  381. # broken on your system.
  382. # Defaults if commented: EnableMMAP On, EnableSendfile Off
  383. #
  384. #EnableMMAP off
  385. EnableSendfile on
  386. {%- for directive, dvalue in salt['pillar.get']('apache:global', {}).items() %}
  387. {{ directive }} {{ dvalue }}
  388. {%- endfor %}
  389. # Supplemental configuration
  390. #
  391. # Load config files in the "/etc/httpd/conf.d" directory, if any.
  392. Include conf.d/*.conf
  393. Include vhosts.d/*.conf