Saltstack Official Nginx 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.

62 lines
1.2KB

  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. /etc/nginx:
  35. file.directory:
  36. - user: root
  37. - group: root
  38. /etc/nginx/nginx.conf:
  39. file:
  40. - managed
  41. - template: jinja
  42. - user: root
  43. - group: root
  44. - mode: 440
  45. - source: salt://nginx/templates/config.jinja
  46. - require:
  47. - file: /etc/nginx
  48. {% for dir in ('sites-enabled', 'sites-available') %}
  49. /etc/nginx/{{ dir }}:
  50. file.directory:
  51. - user: root
  52. - group: root
  53. {% endfor -%}