我正在尝试使用Saltstack部署nginx。我没有使用nginx公式。这是我所拥有的:
nginx:
pkg.installed
service.running:
- require:
- pkg: nginx
- file: /etc/nginx/sites-enabled/com.example.static
- watch:
- file: /etc/nginx/sites-enabled/com.example.static
- method: reload
我也为定义了一个条目/etc/nginx/sites-enabled/com.example.static
。它工作正常-文件已被复制到正确的位置。
问题在于,当Saltstack将配置文件放在系统上时,nginx不会重新加载。我需要先运行,/etc/init.d/nginx reload
然后服务器才能响应对的请求static.example.com
。
您可能需要将reload
指令添加到service.running
https://docs.saltstack.com/zh-CN/latest/ref/states/all/salt.states.service.html
“默认情况下,如果由于监视语句而触发服务刷新,则默认情况下将重新启动该服务。如果所需的行为是重新加载该服务,则将重新加载值设置为True。”
nginx:
...
service.running:
...
- reload: True
- watch:
- file: /etc/nginx/sites-enabled/com.example.static
另请参阅github票证#1122
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句