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.

440 lines
15KB

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