gchef / nginx-cookbook Goto Github PK
View Code? Open in Web Editor NEWnginx setup via chef
nginx setup via chef
Hi, I'm using your cookbook on a vagrant VM with a Debian distro, it doesn't seem to put any conf file to any of the config directory.
my config:
config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = "cookbooks"
chef.log_level = :debug
# chef.roles_path = "../my-recipes/roles"
# chef.data_bags_path = "../my-recipes/data_bags"
# chef.add_recipe "chef-nodejs"
chef.add_recipe "apt"
chef.add_recipe "build-essential"
# chef.add_recipe "php-fpm"
# chef.add_recipe "git"
# chef.add_recipe "curl"
# chef.add_recipe "php"
# chef.add_recipe "php5-imagemagick"
chef.add_recipe "nginx::source"
# chef.add_recipe "mongodb"
# chef.add_role "web"
# You may also specify custom JSON attributes:
chef.json = {
:nginx => {
:apps => {
:paste => {
:listen => [3000],
:server_name => 'paste.dev',
:public_path => '/home/vagrant/html/paste.dev/public',
:try_files => [
'$uri', '$uri/', '@php'
],
:locations => [
:path => '@php',
:directives => [
'fastcgi_pass unix:/var/run/php-fpm/www.sock;',
'include fastcgi_params;',
'fastcgi_param SCRIPT_FILENAME $document_root/index.php;'
]
]
}
}
}
}
end
Instead of relying on :
:nginx => {
:distribution => 'precise',
use in your recipe:
node[:lsb][:codename]
Hi,
I'm sorry if this is a stupid question, but I'm just starting with Chef, and I'd like to deploy multiple apps to the same EC2 instance. The way I see it is that Chef would add a vhost for each app I have, and automatically set them up when the recipe is ran. Does this cookbook support such scenario?
Thanks a lot,
Should be:
source "http://nginx.org/download/nginx-#{node[:nginx][:version]}.tar.gz"
service "nginx" do
supports :status => true, :restart => true, :reload => true
action :enable
end
bash "compile_nginx_source" do
cwd "/usr/local/src"
code <<-EOH
tar zxf nginx-#{node[:nginx][:version]}.tar.gz
cd nginx-#{node[:nginx][:version]} && ./configure #{configure_flags}
make && make install
EOH
creates node[:nginx][:binary]
notifies :restart, resources(:service => "nginx")
end
since the cookbook should work across nginx versions, it'll make sense to set the version as default value (not implicitly)
default[:nginx][:version] = "1.2.4"
so we can override this value with
node.set[:nginx][:version] = "1.2.6"
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.