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.

преди 11 години
преди 11 години
преди 11 години
преди 11 години
преди 11 години
преди 11 години
преди 11 години
преди 11 години
преди 11 години
преди 11 години
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. {# Define default values here so the template below can just focus on layout #}
  2. {% set sitename = site.get('ServerName', id) %}
  3. {% set vals = {
  4. 'interface': site.get('interface', '*'),
  5. 'port': site.get('port', '80'),
  6. 'ServerName': sitename,
  7. 'ServerAlias': site.get('ServerAlias', 'www.{0}'.format(sitename)),
  8. 'ServerAdmin': site.get('ServerAdmin', 'webmaster@{0}'.format(sitename)),
  9. 'DirectoryIndex': site.get('DirectoryIndex'),
  10. 'UseCanonicalName': site.get('UseCanonicalName'),
  11. 'LogLevel': site.get('LogLevel', 'warn'),
  12. 'ErrorLog': site.get('ErrorLog', '{0}/{1}-error.log'.format(map.logdir, sitename)),
  13. 'LogFormat': site.get('LogFormat', '"%h %l %u %t \\\"%r\\\" %>s %O"'),
  14. 'CustomLog': site.get('CustomLog', '{0}/{1}-access.log'.format(map.logdir, sitename)),
  15. 'DocumentRoot': site.get('DocumentRoot', '{0}/{1}'.format(map.wwwdir, sitename)),
  16. 'VirtualDocumentRoot': site.get('VirtualDocumentRoot'),
  17. 'Directory_default': '{0}/{1}'.format(map.wwwdir, sitename),
  18. 'Directory': {
  19. 'Options': '-Indexes FollowSymLinks',
  20. 'Order': 'allow,deny',
  21. 'Allow': 'from all',
  22. 'AllowOverride': 'None',
  23. },
  24. } %}
  25. <VirtualHost {{ vals.interface }}:{{ vals.port }}>
  26. ServerName {{ vals.ServerName }}
  27. {% if site.get('ServerAlias') != False %}ServerAlias {{ vals.ServerAlias }}{% endif %}
  28. {% if site.get('ServerAdmin') != False %}ServerAdmin {{ vals.ServerAdmin }}{% endif %}
  29. {% if site.get('DirectoryIndex') %}DirectoryIndex {{ vals.DirectoryIndex }}{% endif %}
  30. {% if site.get('UseCanonicalName') %}UseCanonicalName {{ vals.UseCanonicalName }}{% endif %}
  31. {% if site.get('LogLevel') != False %}LogLevel {{ vals.LogLevel }}{% endif %}
  32. {% if site.get('ErrorLog') != False %}ErrorLog {{ vals.ErrorLog }}{% endif %}
  33. {% if site.get('CustomLog') != False %}CustomLog {{ vals.CustomLog }} {{ vals.LogFormat }}{% endif %}
  34. {% if site.get('DocumentRoot') != False %}DocumentRoot {{ vals.DocumentRoot }}{% endif %}
  35. {% if site.get('VirtualDocumentRoot') %}VirtualDocumentRoot {{ vals.VirtualDocumentRoot }}{% endif %}
  36. {% for path, dir in site.get('Directory', {}).items() %}
  37. {% set dvals = {
  38. 'Options': dir.get('Options', vals.Directory.Options),
  39. 'Order': dir.get('Order', vals.Directory.Order),
  40. 'Allow': dir.get('Allow', vals.Directory.Allow),
  41. 'AllowOverride': dir.get('AllowOverride', vals.Directory.AllowOverride),
  42. } %}
  43. {% if path == 'default' %}{% set path = vals.Directory_default %}{% endif %}
  44. <Directory "{{ path }}">
  45. {% if dir.get('Options') != False %}Options {{ dvals.Options }}{% endif %}
  46. {% if dir.get('Order') != False %}Order {{ dvals.Order }}{% endif %}
  47. {% if dir.get('Allow') != False %}Allow {{ dvals.Allow }}{% endif %}
  48. {% if dir.get('AllowOverride') != False %}AllowOverride {{ dvals.AllowOverride }}{% endif %}
  49. {% if dir.get('Formula_Append') %}
  50. {{ dir.Formula_Append|indent(8) }}
  51. {% endif %}
  52. </Directory>
  53. {% endfor %}
  54. {% if site.get('Formula_Append') %}
  55. {{ site.Formula_Append|indent(4) }}
  56. {% endif %}
  57. </VirtualHost>