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.

52 lines
2.1KB

  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. {%- from "apache/map.jinja" import apache with context %}
  6. {%- set sitename = site.get('ServerName', id) %}
  7. {%- set vals = {
  8. 'interfaces': site.get('interface', '*').split(),
  9. 'port': site.get('port', '80'),
  10. 'ServerName': sitename,
  11. 'ServerAlias': site.get('ServerAlias', 'www.{0}'.format(sitename)),
  12. 'ServerAdmin': site.get('ServerAdmin', 'webmaster@{0}'.format(sitename)),
  13. 'UseCanonicalName': site.get('UseCanonicalName'),
  14. 'LogLevel': site.get('LogLevel', 'warn'),
  15. 'ErrorLog': site.get('ErrorLog', '{0}/{1}-error.log'.format(map.logdir, sitename)),
  16. 'LogFormat': site.get('LogFormat', '"%h %l %u %t \\\"%r\\\" %>s %O"'),
  17. 'CustomLog': site.get('CustomLog', '{0}/{1}-access.log'.format(map.logdir, sitename)),
  18. 'RedirectSource': site.get('RedirectSource', '/'),
  19. 'RedirectTarget': site.get('RedirectTarget', 'https://{0}/'.format(sitename)),
  20. } %}
  21. <VirtualHost {%- for intf in vals.interfaces %} {{intf}}:{{ vals.port }}{% endfor -%}>
  22. ServerName {{ vals.ServerName }}
  23. {% if site.get('ServerAlias') != False %}ServerAlias {{ vals.ServerAlias }}{% endif %}
  24. {% if site.get('ServerAdmin') != False %}ServerAdmin {{ vals.ServerAdmin }}{% endif %}
  25. {% if site.get('UseCanonicalName') %}UseCanonicalName {{ vals.UseCanonicalName }}{% endif %}
  26. {% if site.get('LogLevel') != False %}LogLevel {{ vals.LogLevel }}{% endif %}
  27. {% if site.get('ErrorLog') != False %}ErrorLog {{ vals.ErrorLog }}{% endif %}
  28. {% if site.get('LogFormat') != False -%}LogFormat {{ vals.LogFormat }}{% endif %}
  29. {% if site.get('CustomLog') != False -%}LogFormat {{ vals.LogFormat }} {{ sitename }}
  30. CustomLog {{ vals.CustomLog }} {{ sitename }}{% endif %}
  31. {% if site.get('RedirectMatch') %}
  32. RedirectMatch {{ vals.RedirectSource }} {{ vals.RedirectTarget }}
  33. {% else %}
  34. Redirect {{ vals.RedirectSource }} {{ vals.RedirectTarget }}
  35. {% endif %}
  36. {% if site.get('Formula_Append') %}
  37. {{ site.Formula_Append|indent(4) }}
  38. {% endif %}
  39. </VirtualHost>