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

70 行
1.3KB

  1. /usr/share/nginx:
  2. file:
  3. - directory
  4. {% for filename in ('default', 'example_ssl') %}
  5. /etc/nginx/conf.d/{{ filename }}.conf:
  6. file.absent
  7. {% endfor %}
  8. {% set logger_types = ('access', 'error') %}
  9. {% for log_type in logger_types %}
  10. /var/log/nginx/{{ log_type }}.log:
  11. file.absent
  12. nginx-logger-{{ log_type }}:
  13. file:
  14. - managed
  15. - name: /etc/init/nginx-logger-{{ log_type }}.conf
  16. - template: jinja
  17. - user: root
  18. - group: root
  19. - mode: 440
  20. - source: salt://nginx/templates/upstart-logger.jinja
  21. - context:
  22. type: {{ log_type }}
  23. service:
  24. - running
  25. - enable: True
  26. - require:
  27. - file: nginx-logger-{{ log_type }}
  28. - require_in:
  29. - service: nginx
  30. {% endfor %}
  31. /etc/logrotate.d/nginx:
  32. file:
  33. - absent
  34. {% for dir in ['sites-available', 'sites-enabled'] -%}
  35. /etc/nginx/{{ dir }}:
  36. file.directory:
  37. - user: www-data
  38. - group: www-data
  39. - mode: 0755
  40. {% endfor -%}
  41. /etc/nginx:
  42. file.directory:
  43. - user: root
  44. - group: root
  45. /etc/nginx/nginx.conf:
  46. file:
  47. - managed
  48. - template: jinja
  49. - user: root
  50. - group: root
  51. - mode: 440
  52. - source: salt://nginx/templates/config.jinja
  53. - require:
  54. - file: /etc/nginx
  55. {% for dir in ('sites-enabled', 'sites-available') %}
  56. /etc/nginx/{{ dir }}:
  57. file.directory:
  58. - user: root
  59. - group: root
  60. {% endfor -%}