Saltstack Official Nginx Formula
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. {% macro sls_block(dict) %}
  2. {% for key, value in dict.items() %}
  3. - {{ key }}: {{ value|json() }}
  4. {% endfor %}
  5. {% endmacro %}
  6. {% set nginx = salt['pillar.get']('nginx:ng', {
  7. 'lookup': salt['grains.filter_by']({
  8. 'Debian': {
  9. 'package': 'nginx',
  10. 'service': 'nginx',
  11. 'webuser': 'www-data',
  12. 'conf_file': '/etc/nginx/nginx.conf',
  13. 'vhost_available': '/etc/nginx/sites-available',
  14. 'vhost_enabled': '/etc/nginx/sites-enabled',
  15. 'vhost_use_symlink': True,
  16. 'pid_file': '/run/nginx.pid',
  17. },
  18. 'RedHat': {
  19. 'package': 'nginx',
  20. 'service': 'nginx',
  21. 'webuser': 'nginx',
  22. 'conf_file': '/etc/nginx/nginx.conf',
  23. 'vhost_available': '/etc/nginx/conf.d',
  24. 'vhost_enabled': '/etc/nginx/conf.d',
  25. 'vhost_use_symlink': False,
  26. 'pid_file': '/run/nginx.pid',
  27. 'rh_os_releasever': '$releasever',
  28. },
  29. 'Suse': {
  30. 'package': 'nginx',
  31. 'service': 'nginx',
  32. 'webuser': 'nginx',
  33. 'conf_file': '/etc/nginx/nginx.conf',
  34. 'vhost_available': '/etc/nginx/conf.d',
  35. 'vhost_enabled': '/etc/nginx/conf.d',
  36. 'vhost_use_symlink': False,
  37. 'pid_file': '/run/nginx.pid',
  38. },
  39. 'Arch': {
  40. 'package': 'nginx',
  41. 'service': 'nginx',
  42. 'webuser': 'http',
  43. 'conf_file': '/etc/nginx/nginx.conf',
  44. 'vhost_available': '/etc/nginx/sites-available',
  45. 'vhost_enabled': '/etc/nginx/sites-enabled',
  46. 'vhost_use_symlink': True,
  47. },
  48. 'Gentoo': {
  49. 'package': 'www-servers/nginx',
  50. 'service': 'nginx',
  51. 'webuser': 'nginx',
  52. 'conf_file': '/etc/nginx/nginx.conf',
  53. 'vhost_available': '/etc/nginx/sites-available',
  54. 'vhost_enabled': '/etc/nginx/sites-enabled',
  55. 'vhost_use_symlink': True,
  56. },
  57. }, default='Debian' ),
  58. 'install_from_source': False,
  59. 'install_from_ppa': False,
  60. 'install_from_repo': False,
  61. 'ppa_version': 'stable',
  62. 'package': {
  63. 'opts': {},
  64. },
  65. 'service': {
  66. 'enable': True,
  67. 'opts': {},
  68. },
  69. 'server': {
  70. 'opts': {},
  71. 'config': {
  72. 'worker_processes': 4,
  73. 'events': {
  74. 'worker_connections': 768,
  75. },
  76. 'http': {
  77. 'sendfile': 'on',
  78. 'tcp_nopush': 'on',
  79. 'tcp_nodelay': 'on',
  80. 'keepalive_timeout': '65',
  81. 'types_hash_max_size': '2048',
  82. 'default_type': 'application/octet-stream',
  83. 'access_log': '/var/log/nginx/access.log',
  84. 'error_log': '/var/log/nginx/error.log',
  85. 'gzip': 'off',
  86. 'gzip_disable': '"msie6"',
  87. 'include': [
  88. '/etc/nginx/mime.types',
  89. '/etc/nginx/conf.d/*.conf',
  90. '/etc/nginx/sites-enabled/*',
  91. ],
  92. },
  93. },
  94. },
  95. 'vhosts': {
  96. 'disabled_postfix': '.disabled',
  97. 'symlink_opts': {},
  98. 'rename_opts': {},
  99. 'managed_opts': {},
  100. 'dir_opts': {
  101. 'makedirs': True,
  102. },
  103. 'managed': {},
  104. },
  105. }, merge=True) %}
  106. {% if 'user' not in nginx.server.config %}
  107. {% do nginx.server.config.update({
  108. 'user': nginx.lookup.webuser,
  109. })%}
  110. {% endif %}
  111. {% if 'pid' not in nginx.server.config and 'pid_file' in nginx.lookup %}
  112. {% do nginx.server.config.update({
  113. 'pid': nginx.lookup.pid_file,
  114. })%}
  115. {% endif %}