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.

пре 10 година
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. },
  17. 'RedHat': {
  18. 'package': 'nginx',
  19. 'service': 'nginx',
  20. 'webuser': 'nginx',
  21. 'conf_file': '/etc/nginx/nginx.conf',
  22. 'vhost_available': '/etc/nginx/conf.d',
  23. 'vhost_enabled': '/etc/nginx/conf.d',
  24. 'vhost_use_symlink': False,
  25. },
  26. 'Suse': {
  27. 'package': 'nginx',
  28. 'service': 'nginx',
  29. 'webuser': 'nginx',
  30. 'conf_file': '/etc/nginx/nginx.conf',
  31. 'vhost_available': '/etc/nginx/conf.d',
  32. 'vhost_enabled': '/etc/nginx/conf.d',
  33. 'vhost_use_symlink': False,
  34. },
  35. }, default='Debian' ),
  36. 'install_from_source': False,
  37. 'install_from_ppa': False,
  38. 'install_from_repo': False,
  39. 'ppa_version': 'stable',
  40. 'package': {
  41. 'opts': {},
  42. },
  43. 'service': {
  44. 'enable': True,
  45. 'opts': {},
  46. },
  47. 'server': {
  48. 'opts': {},
  49. 'config': {
  50. 'worker_processes': 4,
  51. 'pid': '/run/nginx.pid',
  52. 'events': {
  53. 'worker_connections': 768,
  54. },
  55. 'http': {
  56. 'sendfile': 'on',
  57. 'tcp_nopush': 'on',
  58. 'tcp_nodelay': 'on',
  59. 'keepalive_timeout': '65',
  60. 'types_hash_max_size': '2048',
  61. 'default_type': 'application/octet-stream',
  62. 'access_log': '/var/log/nginx/access.log',
  63. 'error_log': '/var/log/nginx/error.log',
  64. 'gzip': 'off',
  65. 'gzip_disable': '"msie6"',
  66. 'include': [
  67. '/etc/nginx/mime.types',
  68. '/etc/nginx/conf.d/*.conf',
  69. '/etc/nginx/sites-enabled/*',
  70. ],
  71. },
  72. },
  73. },
  74. 'vhosts': {
  75. 'disabled_postfix': '.disabled',
  76. 'symlink_opts': {},
  77. 'rename_opts': {},
  78. 'managed_opts': {},
  79. 'dir_opts': {
  80. 'makedirs': True,
  81. },
  82. 'managed': {},
  83. },
  84. }, merge=True) %}
  85. {% if 'user' not in nginx.server.config %}
  86. {% do nginx.server.config.update({
  87. 'user': nginx.lookup.webuser,
  88. })%}
  89. {% endif %}