Saltstack Official Apache Formula

пре 11 година
пре 11 година
пре 11 година
пре 11 година
пре 11 година
пре 11 година
пре 11 година
пре 11 година
пре 10 година
пре 11 година
пре 11 година
пре 11 година
пре 11 година
пре 11 година
пре 11 година
пре 11 година
пре 8 година
пре 10 година
пре 10 година
пре 11 година
пре 11 година
пре 11 година
пре 11 година
пре 11 година
пре 11 година
пре 11 година
пре 11 година
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. #
  2. # This file is managed by Salt! Do not edit by hand!
  3. #
  4. {# Define default values here so the template below can just focus on layout #}
  5. {%- set sitename = site.get('ServerName', id) -%}
  6. {%- set vals = {
  7. 'interfaces': site.get('interface', '*').split(),
  8. 'port': site.get('port', '80'),
  9. 'ServerName': sitename,
  10. 'ServerAlias': site.get('ServerAlias', ''),
  11. 'ServerAdmin': site.get('ServerAdmin', 'webmaster@{0}'.format(sitename)),
  12. 'DirectoryIndex': site.get('DirectoryIndex'),
  13. 'UseCanonicalName': site.get('UseCanonicalName'),
  14. 'AllowEncodedSlashes': site.get('AllowEncodedSlashes', 'Off'),
  15. 'LogLevel': site.get('LogLevel', 'warn'),
  16. 'ErrorLog': site.get('ErrorLog', '{0}/{1}-error.log'.format(map.logdir, sitename)),
  17. 'LogFormat': site.get('LogFormat', '"%h %l %u %t \\\"%r\\\" %>s"'),
  18. 'CustomLog': site.get('CustomLog', '{0}/{1}-access.log'.format(map.logdir, sitename)),
  19. 'DocumentRoot': site.get('DocumentRoot', '{0}/{1}'.format(map.wwwdir, sitename)),
  20. 'VirtualDocumentRoot': site.get('VirtualDocumentRoot'),
  21. 'Timeout': site.get('Timeout'),
  22. 'LimitRequestFields': site.get('LimitRequestFields'),
  23. 'Directory_default': site.get('DocumentRoot', '{0}/{1}'.format(map.wwwdir, sitename)),
  24. 'Directory': {
  25. 'Options': '-Indexes +FollowSymLinks',
  26. 'Order': 'allow,deny',
  27. 'Allow': 'from all',
  28. 'Require': 'all granted',
  29. 'AllowOverride': 'None',
  30. },
  31. 'Location': {
  32. 'Order': 'allow,deny',
  33. 'Allow': 'from all',
  34. 'Require': 'all granted',
  35. },
  36. } -%}
  37. <VirtualHost {% for intf in vals.interfaces %} {{intf}}:{{ vals.port }}{% endfor -%}>
  38. ServerName {{ vals.ServerName }}
  39. {% if site.get('ServerAlias') != False %}ServerAlias {{ vals.ServerAlias }}{% endif %}
  40. {% if site.get('ServerAdmin') != False %}ServerAdmin {{ vals.ServerAdmin }}{% endif %}
  41. {% if site.get('DirectoryIndex') -%}DirectoryIndex {{ vals.DirectoryIndex }}{% endif %}
  42. {% if site.get('UseCanonicalName') -%}UseCanonicalName {{ vals.UseCanonicalName }}{% endif %}
  43. {% if site.get('AllowEncodedSlashes') != False -%}AllowEncodedSlashes {{ vals.AllowEncodedSlashes }}{% endif %}
  44. {% if site.get('LogLevel') != False -%}LogLevel {{ vals.LogLevel }}{% endif %}
  45. {% if site.get('ErrorLog') != False -%}ErrorLog {{ vals.ErrorLog }}{% endif %}
  46. {% if site.get('LogFormat') != False -%}LogFormat {{ vals.LogFormat }}{% endif %}
  47. {% if site.get('CustomLog') != False -%}CustomLog {{ vals.CustomLog }} {{ vals.LogFormat }}{% endif %}
  48. {% if site.get('DocumentRoot') != False -%}DocumentRoot {{ vals.DocumentRoot }}{% endif %}
  49. {% if site.get('VirtualDocumentRoot') -%}VirtualDocumentRoot {{ vals.VirtualDocumentRoot }}{% endif %}
  50. {% if site.get('Timeout') != False and site.get('Timeout') != None %}Timeout {{ vals.Timeout }}{% endif %}
  51. {% if site.get('LimitRequestFields') %}LimitRequestFields {{ vals.LimitRequestFields }}{% endif %}
  52. {% if site.get('SSLCertificateFile') %}SSLEngine on
  53. SSLCertificateFile {{ site.SSLCertificateFile }}
  54. {% if site.get('SSLCertificateKeyFile') %}SSLCertificateKeyFile {{ site.SSLCertificateKeyFile }}{% endif %}
  55. {% if site.get('SSLCertificateChainFile') %}SSLCertificateChainFile {{ site.SSLCertificateChainFile}}{% endif %}
  56. {% endif %}
  57. {% if site.get('Rewrite') %}RewriteEngine on
  58. {{ site.Rewrite }}
  59. {% endif %}
  60. {%- for loc, path in site.get('Alias', {}).items() %}
  61. Alias {{ loc }} {{ path }}
  62. {%- endfor %}
  63. {%- for path, dir in site.get('Directory', {}).items() -%}
  64. {%- set dvals = {
  65. 'Options': dir.get('Options', vals.Directory.Options),
  66. 'Order': dir.get('Order', vals.Directory.Order),
  67. 'Allow': dir.get('Allow', vals.Directory.Allow),
  68. 'Require': dir.get('Require', vals.Directory.Require),
  69. 'AllowOverride': dir.get('AllowOverride', vals.Directory.AllowOverride),
  70. 'Dav': dir.get('Dav', False),
  71. } %}
  72. {%- if path == 'default' %}{% set path = vals.Directory_default %}{% endif %}
  73. <Directory "{{ path }}">
  74. {% if dvals.get('Options') != False %}Options {{ dvals.Options }}{% endif %}
  75. {% if map.version == '2.4' %}
  76. {% if dvals.get('Require') != False %}Require {{dvals.Require}}{% endif %}
  77. {% else %}
  78. {% if dvals.get('Order') != False %}Order {{ dvals.Order }}{% endif %}
  79. {% if dvals.get('Allow') != False %}Allow {{ dvals.Allow }}{% endif %}
  80. {% endif %}
  81. {% if dvals.get('AllowOverride') != False %}AllowOverride {{ dvals.AllowOverride }}{% endif %}
  82. {% if dvals.get('Dav') != False %}Dav On{% endif %}
  83. {% if dir.get('Formula_Append') %}
  84. {{ dir.Formula_Append|indent(8) }}
  85. {% endif %}
  86. </Directory>
  87. {%- endfor %}
  88. {%- for path, loc in site.get('Location', {}).items() %}
  89. {%- set lvals = {
  90. 'Order': loc.get('Order', vals.Location.Order),
  91. 'Allow': loc.get('Allow', vals.Location.Allow),
  92. 'Require': loc.get('Require', vals.Location.Require),
  93. 'Dav': loc.get('Dav', False),
  94. } %}
  95. <Location "{{ path }}">
  96. {% if map.version == '2.4' %}
  97. {%- if lvals.get('Require') != False %}Require {{lvals.Require}}{% endif %}
  98. {% else %}
  99. {%- if lvals.get('Order') != False %}Order {{ lvals.Order }}{% endif %}
  100. {%- if lvals.get('Allow') != False %}Allow {{ lvals.Allow }}{% endif %}
  101. {% endif %}
  102. {%- if lvals.get('Dav') != False %}Dav On{% endif %}
  103. {%- if loc.get('Formula_Append') %}
  104. {{ loc.Formula_Append|indent(8) }}
  105. {% endif %}
  106. </Location>
  107. {% endfor %}
  108. {%- if site.get('Formula_Append') %}
  109. {{ site.Formula_Append|indent(4) }}
  110. {% endif %}
  111. </VirtualHost>