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.

пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 7 година
пре 7 година
пре 10 година
пре 9 година
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  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. 'passenger_package': 'passenger',
  11. 'service': 'nginx',
  12. 'webuser': 'www-data',
  13. 'conf_file': '/etc/nginx/nginx.conf',
  14. 'server_available': '/etc/nginx/sites-available',
  15. 'server_enabled': '/etc/nginx/sites-enabled',
  16. 'server_use_symlink': True,
  17. 'pid_file': '/run/nginx.pid',
  18. 'openssl_package': 'openssl',
  19. },
  20. 'CentOS': {
  21. 'package': 'nginx',
  22. 'passenger_package': 'passenger',
  23. 'service': 'nginx',
  24. 'webuser': 'nginx',
  25. 'conf_file': '/etc/nginx/nginx.conf',
  26. 'server_available': '/etc/nginx/conf.d',
  27. 'server_enabled': '/etc/nginx/conf.d',
  28. 'server_use_symlink': False,
  29. 'pid_file': '/run/nginx.pid',
  30. 'rh_os_releasever': '$releasever',
  31. 'gpg_check': False,
  32. 'gpg_key': 'http://nginx.org/keys/nginx_signing.key',
  33. 'openssl_package': 'openssl',
  34. },
  35. 'RedHat': {
  36. 'package': 'nginx',
  37. 'passenger_package': 'passenger',
  38. 'service': 'nginx',
  39. 'webuser': 'nginx',
  40. 'conf_file': '/etc/nginx/nginx.conf',
  41. 'server_available': '/etc/nginx/conf.d',
  42. 'server_enabled': '/etc/nginx/conf.d',
  43. 'server_use_symlink': False,
  44. 'pid_file': '/run/nginx.pid',
  45. 'rh_os_releasever': '$releasever',
  46. 'gpg_check': False,
  47. 'gpg_key': 'http://nginx.org/keys/nginx_signing.key',
  48. 'passenger': {
  49. 'passenger_root': '/usr/share/ruby/vendor_ruby/phusion_passenger/locations.ini',
  50. 'passenger_instance_registry_dir': ' /var/run/passenger-instreg',
  51. 'passenger_ruby': '/usr/bin/ruby',
  52. },
  53. 'openssl_package': 'openssl',
  54. },
  55. 'Suse': {
  56. 'package': 'nginx',
  57. 'service': 'nginx',
  58. 'webuser': 'nginx',
  59. 'conf_file': '/etc/nginx/nginx.conf',
  60. 'server_available': '/etc/nginx/conf.d',
  61. 'server_enabled': '/etc/nginx/conf.d',
  62. 'server_use_symlink': False,
  63. 'pid_file': '/run/nginx.pid',
  64. 'gpg_check': True,
  65. 'gpg_key': 'http://download.opensuse.org/repositories/server:/http/openSUSE_13.2/repodata/repomd.xml.key',
  66. 'openssl_package': 'openssl',
  67. },
  68. 'Arch': {
  69. 'package': 'nginx',
  70. 'service': 'nginx',
  71. 'webuser': 'http',
  72. 'conf_file': '/etc/nginx/nginx.conf',
  73. 'server_available': '/etc/nginx/sites-available',
  74. 'server_enabled': '/etc/nginx/sites-enabled',
  75. 'server_use_symlink': True,
  76. 'openssl_package': 'openssl',
  77. },
  78. 'Gentoo': {
  79. 'package': 'www-servers/nginx',
  80. 'service': 'nginx',
  81. 'webuser': 'nginx',
  82. 'conf_file': '/etc/nginx/nginx.conf',
  83. 'server_available': '/etc/nginx/sites-available',
  84. 'server_enabled': '/etc/nginx/sites-enabled',
  85. 'server_use_symlink': True,
  86. 'openssl_package': 'dev-libs/openssl',
  87. },
  88. 'FreeBSD': {
  89. 'package': 'nginx',
  90. 'passenger_package': 'passenger',
  91. 'service': 'nginx',
  92. 'webuser': 'www',
  93. 'conf_file': '/usr/local/etc/nginx/nginx.conf',
  94. 'server_available': '/usr/local/etc/nginx/sites-available',
  95. 'server_enabled': '/usr/local/etc/nginx/sites-enabled',
  96. 'server_use_symlink': True,
  97. 'pid_file': '/var/run/nginx.pid',
  98. },
  99. }, default='Debian' ),
  100. 'install_from_source': False,
  101. 'install_from_ppa': False,
  102. 'install_from_repo': False,
  103. 'install_from_phusionpassenger': False,
  104. 'ppa_version': 'stable',
  105. 'source_version': '1.10.0',
  106. 'source_hash': '8ed647c3dd65bc4ced03b0e0f6bf9e633eff6b01bac772bcf97077d58bc2be4d',
  107. 'source': {
  108. 'opts': {},
  109. },
  110. 'package': {
  111. 'opts': {},
  112. },
  113. 'service': {
  114. 'enable': True,
  115. 'opts': {},
  116. },
  117. 'server': {
  118. 'opts': {},
  119. 'config': {
  120. 'worker_processes': 4,
  121. 'events': {
  122. 'worker_connections': 768,
  123. },
  124. 'http': {
  125. 'sendfile': 'on',
  126. 'tcp_nopush': 'on',
  127. 'tcp_nodelay': 'on',
  128. 'keepalive_timeout': '65',
  129. 'types_hash_max_size': '2048',
  130. 'default_type': 'application/octet-stream',
  131. 'access_log': '/var/log/nginx/access.log',
  132. 'error_log': '/var/log/nginx/error.log',
  133. 'gzip': 'off',
  134. 'gzip_disable': '"msie6"',
  135. 'include': [
  136. 'mime.types',
  137. 'conf.d/*.conf',
  138. 'sites-enabled/*',
  139. ],
  140. },
  141. },
  142. },
  143. 'servers': {
  144. 'disabled_postfix': '.disabled',
  145. 'symlink_opts': {},
  146. 'rename_opts': {},
  147. 'managed_opts': {},
  148. 'dir_opts': {
  149. 'makedirs': True,
  150. },
  151. 'managed': {},
  152. },
  153. 'passenger': {
  154. 'passenger_root': '/usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini',
  155. 'passenger_ruby': '/usr/bin/ruby',
  156. },
  157. }, merge=True) %}
  158. {% if 'user' not in nginx.server.config %}
  159. {% do nginx.server.config.update({
  160. 'user': nginx.lookup.webuser,
  161. })%}
  162. {% endif %}
  163. {% if 'pid' not in nginx.server.config and 'pid_file' in nginx.lookup %}
  164. {% do nginx.server.config.update({
  165. 'pid': nginx.lookup.pid_file,
  166. })%}
  167. {% endif %}
  168. {% if salt['grains.get']('os_family') == 'RedHat' %}
  169. {% do nginx.passenger.update({
  170. 'passenger_root': '/usr/share/ruby/vendor_ruby/phusion_passenger/locations.ini',
  171. 'passenger_instance_registry_dir': '/var/run/passenger-instreg',
  172. })%}
  173. {% if salt['grains.get']('osfinger') == 'CentOS-6' %}
  174. {% do nginx.server.config.update({
  175. 'pid': '/var/run/nginx.pid',
  176. })%}
  177. {% do nginx.passenger.update({
  178. 'passenger_root': '/usr/lib/ruby/1.8/phusion_passenger/locations.ini',
  179. })%}
  180. {% endif %}
  181. {% endif %}