Saltstack Official Nginx Formula
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

184 lines
7.6KB

  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. # This is required for RedHat like distros (Amazon Linux) that don't follow semantic versioning for $releasever
  48. rh_os_releasever: '6'
  49. # Currently it can be used on rhel/centos/suse when installing from repo
  50. gpg_check: True
  51. pid_file: /var/run/nginx.pid ### Prevent Rendering SLS error (map.jinja:149) if nginx.server.config.pid undefined (Ubuntu, etc) ###
  52. # Source compilation is not currently a part of nginx.ng
  53. from_source: False
  54. source:
  55. opts: {}
  56. package:
  57. opts: {} # this partially exposes parameters of pkg.installed
  58. service:
  59. enable: True # Whether or not the service will be enabled/running or dead
  60. opts: {} # this partially exposes parameters of service.running / service.dead
  61. server:
  62. opts: {} # this partially exposes file.managed parameters as they relate to the main nginx.conf file
  63. # nginx.conf (main server) declarations
  64. # dictionaries map to blocks {} and lists cause the same declaration to repeat with different values
  65. config:
  66. source_path: salt://path_to_nginx_conf_file/nginx.conf # IMPORTANT: This option is mutually exclusive with the rest of the
  67. # options; if it is found other options (worker_processes: 4 and so
  68. # on) are not processed and just upload the file from source
  69. worker_processes: 4
  70. pid: /var/run/nginx.pid ### Directory location must exist
  71. events:
  72. worker_connections: 768
  73. http:
  74. sendfile: 'on'
  75. include:
  76. #### Note: Syntax issues in these files generate nginx [emerg] errors on startup. ####
  77. - /etc/nginx/mime.types
  78. - /etc/nginx/conf.d/*.conf
  79. - /etc/nginx/sites-enabled/*
  80. servers:
  81. disabled_postfix: .disabled # a postfix appended to files when doing non-symlink disabling
  82. symlink_opts: {} # partially exposes file.symlink params when symlinking enabled sites
  83. rename_opts: {} # partially exposes file.rename params when not symlinking disabled/enabled sites
  84. managed_opts: {} # partially exposes file.managed params for managed server files
  85. dir_opts: {} # partially exposes file.directory params for site available/enabled dirs
  86. # server declarations
  87. # servers will default to being placed in server_available
  88. managed:
  89. mysite: # relative pathname of the server file
  90. # may be True, False, or None where True is enabled, False, disabled, and None indicates no action
  91. enabled: True
  92. # Remove the site config file. Nice to clean up the conf.d (or sites-available).
  93. # It also remove the symlink (if it is exists).
  94. # The site MUST be disabled before delete it (if not the nginx is not reloaded).
  95. deleted: True
  96. ###########
  97. ## Modify 'available_dir' AND 'enabled_dir' '/etc/nginx' location to alternative value.
  98. ###########
  99. available_dir: /etc/nginx/sites-available # an alternate directory (not sites-available) where this server may be found
  100. enabled_dir: /etc/nginx/sites-enabled # an alternate directory (not sites-enabled) where this server may be found
  101. disabled_name: mysite.aint_on # an alternative disabled name to be use when not symlinking
  102. overwrite: True # overwrite an existing server file or not
  103. # May be a list of config options or None, if None, no server file will be managed/templated
  104. # Take server directives as lists of dictionaries. If the dictionary value is another list of
  105. # dictionaries a block {} will be started with the dictionary key name
  106. config:
  107. - server:
  108. - server_name: localhost
  109. - listen:
  110. - 80
  111. - default_server
  112. - index:
  113. - index.html
  114. - index.htm
  115. - location ~ .htm:
  116. - try_files:
  117. - $uri
  118. - $uri/ =404
  119. - test: something else
  120. # The above outputs:
  121. # server {
  122. # server_name localhost;
  123. # listen 80 default_server;
  124. # index index.html index.htm;
  125. # location ~ .htm {
  126. # try_files $uri $uri/ =404;
  127. # test something else;
  128. # }
  129. # }
  130. mysite2: # Using source_path options to upload the file instead of templating all the file
  131. enabled: True
  132. available_dir: /etc/nginx/sites-available
  133. enabled_dir: /etc/nginx/sites-enabled
  134. config:
  135. source_path: salt://path-to-site-file/mysite2
  136. certificates_path: '/etc/nginx/ssl' # Use this if you need to deploy below certificates in a custom path.
  137. # If you're doing SSL termination, you can deploy certificates this way.
  138. # The private one(s) should go in a separate pillar file not in version
  139. # control (or use encrypted pillar data).
  140. certificates:
  141. 'www.example.com':
  142. public_cert: |
  143. -----BEGIN CERTIFICATE-----
  144. (Your Primary SSL certificate: www.example.com.crt)
  145. -----END CERTIFICATE-----
  146. -----BEGIN CERTIFICATE-----
  147. (Your Intermediate certificate: ExampleCA.crt)
  148. -----END CERTIFICATE-----
  149. -----BEGIN CERTIFICATE-----
  150. (Your Root certificate: TrustedRoot.crt)
  151. -----END CERTIFICATE-----
  152. private_key: |
  153. -----BEGIN RSA PRIVATE KEY-----
  154. (Your Private Key: www.example.com.key)
  155. -----END RSA PRIVATE KEY-----
  156. # Passenger configuration
  157. # Default passenger configuration is provided, and will be deployed in
  158. # /etc/nginx/conf.d/passenger.conf
  159. passenger:
  160. passenger_root: /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini
  161. passenger_ruby: /usr/bin/ruby
  162. passenger_instance_registry_dir: /var/run/passenger-instreg