我对厨师的使用相当陌生,特别是对于stream浪汉来说,这对于那些更有经验的用户来说很可能是一个愚蠢的问题。
我正在使用这本食谱: https : //github.com/opscode-cookbooks/application_nginx
我只是想添加我自己的网站configuration(虚拟主机)。
它必须是以下之一:
选项1对我来说看起来不太合适,我不知道如何完成选项2,而不必完全分开食谱。
任何人都可以build议如何实现?
如果你只是想通过nginxconfiguration一个虚拟主机,可能你想用nginx的食谱。 application_nginx食谱不能直接使用; 而是应用食谱的依赖。 如果你刚刚开始与厨师开始,我会暂时避免应用食谱,因为它的使用有点复杂。
正确的做法是创build自己的食谱configuration您的网站,并使用其中的nginx食谱。 将第三方食谱作为通用库用于您自己的食谱,而不是为了针对您的应用程序进行分类和修改。
例如,食谱中的默认配方可能是:
# run the nginx::default recipe to install nginx include_recipe "nginx" # deploy your sites configuration from the 'files/' directory in your cookbook cookbook_file "#{node['nginx']['dir']}/sites-available/example.com" do owner "root" group "root" mode "0644" end # enable your sites configuration using a definition from the nginx cookbook nginx_site "example.com" do enable true end