Saltstack Official Nginx Formula
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

215 lines
8.7KB

  1. # nginx:
  2. install_from_source: True
  3. use_upstart: True
  4. use_sysvinit: False
  5. user_auth_enabled: True
  6. with_luajit: False
  7. with_openresty: True
  8. repo_version: development # Must be using ppa install by setting `repo_source = ppa`
  9. set_real_ips: # NOTE: to use this, nginx must have http_realip module enabled
  10. from_ips:
  11. - 10.10.10.0/24
  12. real_ip_header: X-Forwarded-For
  13. modules:
  14. headers-more:
  15. source: http://github.com/agentzh/headers-more-nginx-module/tarball/v0.21
  16. source_hash: sha1=dbf914cbf3f7b6cb7e033fa7b7c49e2f8879113b
  17. # ========
  18. # nginx.ng
  19. # ========
  20. nginx:
  21. ng:
  22. # The following three `install_from_` options are mutually exclusive. If none is used, the distro's provided
  23. # package will be installed. If one of the `install_from` option is set to `True`, the state will
  24. # make sure the other two repos are removed.
  25. # Use the official's nginx repo binaries
  26. install_from_repo: false
  27. # Use Phusionpassenger's repo to install nginx and passenger binaries
  28. # Debian, Centos, Ubuntu and Redhat are currently available
  29. install_from_phusionpassenger: false
  30. # PPA install
  31. install_from_ppa: false
  32. # Set to 'stable', 'development' (mainline), 'community', or 'nightly' for each build accordingly ( https://launchpad.net/~nginx )
  33. ppa_version: 'stable'
  34. # Source install
  35. source_version: '1.10.0'
  36. source_hash: ''
  37. # These are usually set by grains in map.jinja
  38. # Typically you can comment these out.
  39. lookup:
  40. package: nginx-custom
  41. service: nginx
  42. webuser: www-data
  43. conf_file: /etc/nginx/nginx.conf
  44. server_available: /etc/nginx/sites-available
  45. server_enabled: /etc/nginx/sites-enabled
  46. server_use_symlink: True
  47. # If you install nginx+passenger from phusionpassenger in Debian, these values will probably be needed
  48. passenger_package: libnginx-mod-http-passenger
  49. passenger_config_file: /etc/nginx/conf.d/mod-http-passenger.conf
  50. # This is required for RedHat like distros (Amazon Linux) that don't follow semantic versioning for $releasever
  51. rh_os_releasever: '6'
  52. # Currently it can be used on rhel/centos/suse when installing from repo
  53. gpg_check: True
  54. pid_file: /var/run/nginx.pid ### Prevent Rendering SLS error (map.jinja:149) if nginx.server.config.pid undefined (Ubuntu, etc) ###
  55. # Source compilation is not currently a part of nginx.ng
  56. from_source: False
  57. source:
  58. opts: {}
  59. package:
  60. opts: {} # this partially exposes parameters of pkg.installed
  61. service:
  62. enable: True # Whether or not the service will be enabled/running or dead
  63. opts: {} # this partially exposes parameters of service.running / service.dead
  64. server:
  65. opts: {} # this partially exposes file.managed parameters as they relate to the main nginx.conf file
  66. # nginx.conf (main server) declarations
  67. # dictionaries map to blocks {} and lists cause the same declaration to repeat with different values
  68. config:
  69. source_path: salt://path_to_nginx_conf_file/nginx.conf # IMPORTANT: This option is mutually exclusive with the rest of the
  70. # options; if it is found other options (worker_processes: 4 and so
  71. # on) are not processed and just upload the file from source
  72. worker_processes: 4
  73. pid: /var/run/nginx.pid ### Directory location must exist
  74. events:
  75. worker_connections: 768
  76. http:
  77. sendfile: 'on'
  78. include:
  79. #### Note: Syntax issues in these files generate nginx [emerg] errors on startup. ####
  80. - /etc/nginx/mime.types
  81. - /etc/nginx/conf.d/*.conf
  82. - /etc/nginx/sites-enabled/*
  83. servers:
  84. disabled_postfix: .disabled # a postfix appended to files when doing non-symlink disabling
  85. symlink_opts: {} # partially exposes file.symlink params when symlinking enabled sites
  86. rename_opts: {} # partially exposes file.rename params when not symlinking disabled/enabled sites
  87. managed_opts: {} # partially exposes file.managed params for managed server files
  88. dir_opts: {} # partially exposes file.directory params for site available/enabled dirs
  89. # server declarations
  90. # servers will default to being placed in server_available
  91. managed:
  92. mysite: # relative pathname of the server file
  93. # may be True, False, or None where True is enabled, False, disabled, and None indicates no action
  94. enabled: True
  95. # Remove the site config file. Nice to clean up the conf.d (or sites-available).
  96. # It also remove the symlink (if it is exists).
  97. # The site MUST be disabled before delete it (if not the nginx is not reloaded).
  98. deleted: True
  99. ###########
  100. ## Modify 'available_dir' AND 'enabled_dir' '/etc/nginx' location to alternative value.
  101. ###########
  102. available_dir: /etc/nginx/sites-available # an alternate directory (not sites-available) where this server may be found
  103. enabled_dir: /etc/nginx/sites-enabled # an alternate directory (not sites-enabled) where this server may be found
  104. disabled_name: mysite.aint_on # an alternative disabled name to be use when not symlinking
  105. overwrite: True # overwrite an existing server file or not
  106. # May be a list of config options or None, if None, no server file will be managed/templated
  107. # Take server directives as lists of dictionaries. If the dictionary value is another list of
  108. # dictionaries a block {} will be started with the dictionary key name
  109. config:
  110. - server:
  111. - server_name: localhost
  112. - listen:
  113. - 80
  114. - default_server
  115. - index:
  116. - index.html
  117. - index.htm
  118. - location ~ .htm:
  119. - try_files:
  120. - $uri
  121. - $uri/ =404
  122. - test: something else
  123. # The above outputs:
  124. # server {
  125. # server_name localhost;
  126. # listen 80 default_server;
  127. # index index.html index.htm;
  128. # location ~ .htm {
  129. # try_files $uri $uri/ =404;
  130. # test something else;
  131. # }
  132. # }
  133. mysite2: # Using source_path options to upload the file instead of templating all the file
  134. enabled: True
  135. available_dir: /etc/nginx/sites-available
  136. enabled_dir: /etc/nginx/sites-enabled
  137. config:
  138. source_path: salt://path-to-site-file/mysite2
  139. # Below configuration becomes handy if you want to create custom configuration files
  140. # for example if you want to create /usr/local/etc/nginx/http_options.conf with
  141. # the following content:
  142. # sendfile on;
  143. # tcp_nopush on;
  144. # tcp_nodelay on;
  145. # send_iowait 12000;
  146. http_options.conf:
  147. enabled: True
  148. available_dir: /usr/local/etc/nginx
  149. enabled_dir: /usr/local/etc/nginx
  150. config:
  151. - sendfile: 'on'
  152. - tcp_nopush: 'on'
  153. - tcp_nodelay: 'on'
  154. - send_iowait: 12000
  155. certificates_path: '/etc/nginx/ssl' # Use this if you need to deploy below certificates in a custom path.
  156. # If you're doing SSL termination, you can deploy certificates this way.
  157. # The private one(s) should go in a separate pillar file not in version
  158. # control (or use encrypted pillar data).
  159. certificates:
  160. 'www.example.com':
  161. public_cert: |
  162. -----BEGIN CERTIFICATE-----
  163. (Your Primary SSL certificate: www.example.com.crt)
  164. -----END CERTIFICATE-----
  165. -----BEGIN CERTIFICATE-----
  166. (Your Intermediate certificate: ExampleCA.crt)
  167. -----END CERTIFICATE-----
  168. -----BEGIN CERTIFICATE-----
  169. (Your Root certificate: TrustedRoot.crt)
  170. -----END CERTIFICATE-----
  171. private_key: |
  172. -----BEGIN RSA PRIVATE KEY-----
  173. (Your Private Key: www.example.com.key)
  174. -----END RSA PRIVATE KEY-----
  175. dh_param:
  176. 'mydhparam1.pem': |
  177. -----BEGIN DH PARAMETERS-----
  178. (Your custom DH prime)
  179. -----END DH PARAMETERS-----
  180. # or to generate one on-the-fly
  181. 'mydhparam2.pem':
  182. keysize: 2048
  183. # Passenger configuration
  184. # Default passenger configuration is provided, and will be deployed in
  185. # /etc/nginx/conf.d/passenger.conf
  186. passenger:
  187. passenger_root: /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini
  188. passenger_ruby: /usr/bin/ruby
  189. passenger_instance_registry_dir: /var/run/passenger-instreg