這是爲我工作:
Vagrant.configure("2") do |config|
config.vm.box = "opscode-ubuntu-14.04"
config.vm.box_url = "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_ubuntu-14.04_chef-provisionerless.box"
config.omnibus.chef_version = :latest
config.vm.provision "shell", inline: "echo 'set nocp' > /home/vagrant/.vimrc"
config.vm.define "nginx" do |nginx|
nginx.vm.network "private_network", ip: "192.168.33.14"
nginx.vm.provision :chef_solo do |chef|
chef.cookbooks_path = "cookbooks"
chef.add_recipe "nginx"
chef.json = {
:nginx => {
dir: '/etc/nginx' # this is the default value, sample only
}
}
end
nginx.vm.provision "shell",
inline: "echo -e $1 > /etc/nginx/conf.d/nginx.conf",
args: [<<-EOS
server {
listen *:80;
location ~ ^/ {
proxy_pass http://192.168.33.11:8080;
}
}
EOS
]
end
需要注意的是,我寫nginx.config,我可以寫其他每個站點CONFIGS(domain1.conf,domain2.conf),他們都將被加載。
我最終需要拉下了不少食譜:
https://github.com/opscode-cookbooks/nginx
https://github.com/opscode-cookbooks/build-essential
https://github.com/opscode-cookbooks/ohai
https://github.com/opscode-cookbooks/bluepill
https://github.com/opscode-cookbooks/rsyslog
https://github.com/hw-cookbooks/runit
??
https://github.com/opscode-cookbooks/yum
你見過在GitHub上的文檔:https://github.com/opscode-cookbooks/nginx – sethvargo
在廚師界的格式網站對於閱讀食譜的自述文件不是特別好。嘗試在[GitHub頁面](https://github.com/opscode-cookbooks/nginx) – cassianoleal
感謝您的意見。事實上,它更容易閱讀,但我還沒有理解進入Vagrantfile的格式。任何文檔或例子將不勝感激。 – Bastian