第3章 Linux state 方式安装nginx 服务
3.1 State 方式安装nginx
1,创建相应的目录
a)Mkdir –p /srv/nginx
2,生成nginx.sls 文件
a)Vim /srv/nginx/init.sls
nginx:
pkg:
- installed
service:
- running
- watch:
- pkg: nginx
- file: /etc/nginx/nginx.conf
/etc/nginx/nginx.conf:
file.managed:
- source: salt://nginx/nginx.conf
- user: root
- group: root
- mode: 644
b)生成nginx 配置文件
i.Copy线上nginx.conf
3,安装nginx
4, Salt ‘*linux” state.sls nginx
5,http://docs.saltstack.com/topics/tutorials/starting_states.html
本文转自 swq499809608 51CTO博客,原文链接:http://blog.51cto.com/swq499809608/1184484