2015-02-11 93 views
0

这是我非常基本的食谱/ default.rb文件;厨师错误在资源服务[httpd]上执行操作`start`

package "httpd" do 
     action :install 
end 

node["apache"]["sites"].each do |sitename, data| 
     document_root = "/content/sites/#{sitename}" 

     directory document_root do 
       mode "0755" 
       recursive true 
     end 

template "/etc/httpd/conf.d/#{sitename}.conf" do 
     source "vhost.erb" 
     mode "0644" 
     variables(
       :document_root => document_root, 
       :port => data["port"], 
       :domain => data["domain"] 
     ) 
     notifies :restart, "service[httpd]" 
end 

end 

service "httpd" do 
     action [:enable, :start] 
end 

当我在它返回以下错误的节点运行厨师客户端:

Error executing action `start` on resource 'service[httpd]' 
    ================================================================================ 

    Mixlib::ShellOut::ShellCommandFailed 
    ------------------------------------ 
    Expected process to exit with [0], but received '1' 
    ---- Begin output of /sbin/service httpd start ---- 
    STDOUT: Starting httpd: [FAILED] 
    STDERR: Syntax error on line 15 of /etc/httpd/conf.d/stedelahunty2.conf: 
    order takes one argument, 'allow,deny', 'deny,allow', or 'mutual-failure' 
    ---- End output of /sbin/service httpd start ---- 
    Ran /sbin/service httpd start returned 1 

    Resource Declaration: 
    --------------------- 
    # In /var/chef/cache/cookbooks/apache/recipes/default.rb 

    35: service "httpd" do 
    36: action [:enable, :start] 
    37: end 

    Compiled Resource: 
    ------------------ 
    # Declared in /var/chef/cache/cookbooks/apache/recipes/default.rb:35:in `from_file' 

    service("httpd") do 
     action [:enable, :start] 
     supports {:restart=>false, :reload=>false, :status=>true} 
     retries 0 
     retry_delay 2 
     default_guard_interpreter :default 
     service_name "httpd" 
     enabled true 
     pattern "httpd" 
     declared_type :service 
     cookbook_name "apache" 
     recipe_name "default" 
    end 

我试图重新命名它的Apache,使选项更改“:重启”,完全注释掉但这意味着httpd无法启动。我只需要一个简单的方法在主厨运行完成后重新启动服务。

再次,道歉的新手问题;我对编码很陌生。

干杯

回答

1

这不是厨师问题。阿帕奇httpd报告

Syntax error on line 15 of /etc/httpd/conf.d/stedelahunty2.conf: order takes one argument, 'allow,deny', 'deny,allow', or 'mutual-failure'

+0

啊好的,所以它将成为一个基本的Apache服务器,我应该离开哪些选项? – 2015-02-11 07:13:09

+0

对不起,我不知道。你想达到什么目的,食谱中的'vhost.erb'如何响应。节点上的'/ etc/httpd/conf.d/stedelahunty2.conf'看起来像什么? – StephenKing 2015-02-11 07:27:48

+0

我复制并从另一个示例粘贴到我的食谱中,它似乎已工作。不幸的是,这并没有给我知识来修复我的解决方案,但它现在工作。感谢您尝试提供帮助。谢谢 – 2015-02-11 07:32:54