文件路径:130

[130bastion@192 nginx]$ pwd

/srv/salt/nginx

执行 salt ip  nginx.install

cat install.sls

env-install:
  pkg.installed:
    - names:
      - gcc
      - pcre
      - pcre-devel
      - openssl
      - openssl-devel
      - libxslt
      - libxslt-devel
      - libxml2-devel
      - gd
      - gd-devel
      - GeoIP
      - GeoIP-devel
www:
  user.present:
    - uid: 600
    - shell: /sbin/nologin

tar-tengine:
  file.managed:
    - name : /usr/local/src/tengine-2.1.1.tar.gz
    - source: salt://nginx/files/tengine-2.1.1.tar.gz
    - user: root
    - group: root
    - mode: 664
  cmd.run:
    - user: root
    - cwd: /usr/local/src/
    - name: tar zxvf tengine-2.1.1.tar.gz


tengine-install:
  cmd.run:
    - user: root
    - cwd: /usr/local/src/tengine-2.1.1
    - name: ./configure --prefix=/usr/local/nginx --user=www --group=www --with-poll_module --with-pcre --with-http_realip_module --with-http_dav_module --with-http_gzip_static_module --with-http_degradation_module --with-http_addition_module=shared --with-http_xslt_module=shared --with-http_image_filter_module=shared --with-http_geoip_module=shared --with-http_sub_module=shared --with-http_flv_module=shared --with-http_slice_module=shared --with-http_mp4_module=shared --with-http_concat_module=shared --with-http_random_index_module=shared --with-http_secure_link_module=shared --with-http_sysguard_module=shared --with-http_charset_filter_module=shared --with-http_userid_filter_module=shared --with-http_footer_filter_module=shared --with-http_access_module=shared --with-http_autoindex_module=shared --with-http_map_module=shared --with-http_split_clients_module=shared --with-http_referer_module=shared --with-http_rewrite_module=shared --with-http_fastcgi_module=shared --with-http_uwsgi_module=shared --with-http_scgi_module=shared --with-http_memcached_module=shared --with-http_limit_conn_module=shared --with-http_limit_req_module=shared --with-http_empty_gif_module=shared --with-http_browser_module=shared --with-http_user_agent_module=shared --with-http_upstream_ip_hash_module=shared --with-http_upstream_least_conn_module=shared  && make && make install
    - require:
      - pkg: env-install
      - file: tar-tengine
/usr/local/nginx/conf/nginx.conf:
  file.managed:
    - source: salt://nginx/files/nginx.conf
    - user: root
    - group: root
    - mode: 755
    - require:
      - cmd: tengine-install


/usr/local/nginx/conf/vhost:
  file.directory:
    - user: root
    - group: root
    - dir_mode: 755
    - file_mode: 644
    - recurse:
        - user
        - group
        - mode

/usr/local/nginx/conf/vhost/report.zhen.com:
  file.managed:
    - source: salt://nginx/files/vhost/report.zhen.com
    - user: root
    - group: root
    - mode: 755

/usr/local/nginx/conf/vhost/upstream:
  file.managed:
    - source: salt://nginx/files/vhost/upstream
    - user: root
    - group: root
    - mode: 755
tengine-service:
  file.managed:
    - name: /etc/init.d/nginx
    - source: salt://nginx/files/nginx.init
    - user: root
    - group: root
    - mode: 755
  cmd.run:
    - name: chkconfig --add nginx && chkconfig nginx on
    - require:
      - file: tengine-service
  service.running:
    - name: nginx
    - enable: True
    - reload: True
    - require:
      - file: tengine-service