【发布时间】:2015-11-07 23:02:08
【问题描述】:
我正在尝试使用 chef 来配置一个带有 nginx 的 centos 网络服务器。我想使用 http_auth_request_module 和 headers_more_module。我的角色如下所示:
{
"name" : "cms-aws",
"description" : "a role to deploy cms to aws",
"default_attributes" : {
"nginx" : {
"source" : {
"modules" : ["nginx::http_auth_request_module","nginx::headers_more_module"]
}
}
},
"run_list" : [
"runit",
"python",
"build-essential",
"gunicorn",
"nginx::source",
"openssl",
"yum",
"git",
"yum-epel",
"my-custom-cookbook",
"supervisor"
]
}
但是,当我在服务器上运行 nginx -V 时,这些模块没有列出,当我在我的 conf 文件中使用 auth_request 指令时,nginx 会抱怨。
我也尝试了以下属性,但是当我运行它时厨师找不到那些食谱:
"default_attributes" : {
"nginx" : {
"source" : {
"modules" : ["http_auth_request_module","headers_more_module"]
}
}
},
编辑: 所以我已经确定我运行它的 AMI 已经安装了 nginx。因此,当 systemctl 启动 nginx 时,它会命中先前存在的,而不是厨师安装的那个。我尝试修改我的属性:
"default_attributes" : {
"nginx" : {
"source" : {
"modules" : ["nginx::http_auth_request_module","nginx::headers_more_module"]
},
"binary" : "/usr/sbin/nginx"
}
},
但是 chef 仍然在/opt/nginx-1.6.2/sbin/nginx 安装 nginx,知道如何纠正这个问题吗?
编辑编辑:原来 nginx 没有在这个 AMI 上开箱即用地安装,所以说明书将它安装在 /usr/sbin/nginx,但是当我运行 nginx -V 时,没有列出所需的模块。当我运行/opt/nginx-1.6.2/sbin/nginx -V 时,它会列出请求的模块。
【问题讨论】:
-
在那个盒子上,当你运行
which -a nginx时你会得到什么?基本上,nginx中安装/链接/找到了多少个地方?
标签: nginx centos chef-infra