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.

51 lines
1.3KB

  1. # nginx.ng.src
  2. #
  3. # Manages installation of nginx from source.
  4. {% from 'nginx/ng/map.jinja' import nginx, sls_block with context %}
  5. nginx_deps:
  6. pkg.installed:
  7. - pkgs:
  8. - libpcre3-dev
  9. - libssl-dev
  10. - zlib1g-dev
  11. nginx_download:
  12. archive.extracted:
  13. - name: /tmp/
  14. - source: http://nginx.org/download/nginx-{{ nginx.source_version }}.tar.gz
  15. - source_hash: sha256={{ nginx.source_hash }}
  16. - archive_format: tar
  17. - if_missing: /usr/sbin/nginx-{{ nginx.source_version }}
  18. - require:
  19. - pkg: nginx_deps
  20. nginx_configure:
  21. cmd.run:
  22. - name: ./configure --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path={{ nginx.lookup.conf_file or '/etc/nginx/nginx.conf' }} {{ nginx.source.opts | join(' ') }}
  23. - cwd: /tmp/nginx-{{ nginx.source_version }}
  24. - onchanges:
  25. - archive: nginx_download
  26. nginx_compile:
  27. cmd.run:
  28. - name: make
  29. - cwd: /tmp/nginx-{{ nginx.source_version }}
  30. - onchanges:
  31. - cmd: nginx_configure
  32. nginx_install:
  33. cmd.run:
  34. - name: make install
  35. - cwd: /tmp/nginx-{{ nginx.source_version }}
  36. - onchanges:
  37. - cmd: nginx_compile
  38. nginx_link:
  39. file.copy:
  40. - name: /usr/sbin/nginx-{{ nginx.source_version }}
  41. - source: /usr/sbin/nginx
  42. - onchanges:
  43. - cmd: nginx_install