Saltstack Official Apache Formula
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

65 行
2.6KB

  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. 'LogLevel': site.get('LogLevel', 'warn'),
  10. 'ErrorLog': site.get('ErrorLog', '{0}/{1}-error.log'.format(map.logdir, sitename)),
  11. 'CustomLog': site.get('ErrorLog', '{0}/{1}-access.log'.format(map.logdir, sitename)),
  12. 'DocumentRoot': site.get('DocumentRoot', '{0}/{1}'.format(map.wwwdir, sitename)),
  13. 'Directory_default': '{0}/{1}'.format(map.wwwdir, sitename),
  14. 'Directory': {
  15. 'Options': '-Indexes FollowSymLinks',
  16. 'Order': 'allow,deny',
  17. 'Allow': 'from all',
  18. 'AllowOverride': 'None',
  19. },
  20. } %}
  21. <VirtualHost {{ vals.interface }}:{{ vals.port }}>
  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('LogLevel') != False %}LogLevel {{ vals.LogLevel }}{% endif %}
  26. {% if site.get('ErrorLog') != False %}ErrorLog {{ vals.ErrorLog }}{% endif %}
  27. {% if site.get('CustomLog') != False %}CustomLog {{ vals.CustomLog }}{% endif %}
  28. {% if site.get('DocumentRoot') != False %}DocumentRoot {{ vals.DocumentRoot }}{% endif %}
  29. {% for path, dir in site.get('Directory', {}).items() %}
  30. {% set dvals = {
  31. 'Options': dir.get('Options', vals.Directory.Options),
  32. 'Order': dir.get('Order', vals.Directory.Order),
  33. 'Allow': dir.get('Order', vals.Directory.Allow),
  34. 'AllowOverride': dir.get('Order', vals.Directory.AllowOverride),
  35. } %}
  36. {% if path == 'default' %}{% set path = vals.Directory_default %}{% endif %}
  37. <Directory "{{ path }}">
  38. {% if dir.get('Options') != False %}Options {{ dvals.Options }}{% endif %}
  39. {% if dir.get('Order') != False %}Order {{ dvals.Order }}{% endif %}
  40. {% if dir.get('Allow') != False %}Allow {{ dvals.Allow }}{% endif %}
  41. {% if dir.get('AllowOverride') != False %}AllowOverride {{ dvals.AllowOverride }}{% endif %}
  42. {% if dir.get('Formula_Append') %}
  43. {{ dir.Formula_Append|indent(8) }}
  44. {% endif %}
  45. </Directory>
  46. {% endfor %}
  47. {% if site.get('Formula_Append') %}
  48. {{ site.Formula_Append|indent(4) }}
  49. {% endif %}
  50. </VirtualHost>