Skip to content

Instantly share code, notes, and snippets.

@dwynne
Created June 24, 2013 19:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dwynne/5852944 to your computer and use it in GitHub Desktop.
Save dwynne/5852944 to your computer and use it in GitHub Desktop.
Application cookbook overriding the default options for nginx
cookbook 'nginx-app', '~> 0.1.0', path: 'cookbooks/nginx-app'
server {
listen 8080;
server_name <%= node['hostname'] %>;
access_log <%= node['nginx']['log_dir'] %>/localhost.access.log;
location / {
root /var/www/nginx-default;
index index.html index.htm;
}
}
include_recipe 'nginx'
node.override['nginx']['gzip'] = "off"
begin
t = resources("template[#{node['nginx']['dir']}/sites-available/default]")
t.source "default-site.erb"
t.cookbook "nginx-app"
rescue Chef::Exceptions::ResourceNotFound
Chef::Log.warn "could not find template your template override!"
end
name 'nginx-app'
maintainer 'YOUR_NAME'
maintainer_email 'YOUR_EMAIL'
license 'All rights reserved'
description 'Installs/Configures nginx-app'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '0.1.0'
depends 'nginx', '~> 1.7.0'
Vagrant.configure("2") do |config|
config.vm.define :web do |web|
web.vm.box = "precise64"
web.vm.box_url = "http://files.vagrantup.com/precise64.box"
web.vm.network :private_network, ip: "192.168.60.10"
web.berkshelf.enabled = true
web.vm.provision :shell, :inline => "gem install chef --version 11.4.2 --no-rdoc --no-ri --conservative"
web.vm.provision :chef_solo do |chef|
chef.add_recipe "apt"
chef.add_recipe "nginx-app"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment