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.

64 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. {% if pillar.get('nginx', {}).get('use_upstart', true) %}
  9. {% set logger_types = ('access', 'error') %}
  10. {% for log_type in logger_types %}
  11. /var/log/nginx/{{ log_type }}.log:
  12. file.absent
  13. nginx-logger-{{ log_type }}:
  14. file:
  15. - managed
  16. - name: /etc/init/nginx-logger-{{ log_type }}.conf
  17. - template: jinja
  18. - user: root
  19. - group: root
  20. - mode: 440
  21. - source: salt://nginx/templates/upstart-logger.jinja
  22. - context:
  23. type: {{ log_type }}
  24. service:
  25. - running
  26. - enable: True
  27. - require:
  28. - file: nginx-logger-{{ log_type }}
  29. - require_in:
  30. - service: nginx
  31. {% endfor %}
  32. /etc/logrotate.d/nginx:
  33. file:
  34. - absent
  35. {% endif %}
  36. /etc/nginx:
  37. file.directory:
  38. - user: root
  39. - group: root
  40. /etc/nginx/nginx.conf:
  41. file:
  42. - managed
  43. - template: jinja
  44. - user: root
  45. - group: root
  46. - mode: 440
  47. - source: salt://nginx/templates/config.jinja
  48. - require:
  49. - file: /etc/nginx
  50. {% for dir in ('sites-enabled', 'sites-available') %}
  51. /etc/nginx/{{ dir }}:
  52. file.directory:
  53. - user: root
  54. - group: root
  55. {% endfor -%}