Created
June 24, 2013 19:47
-
-
Save dwynne/5852944 to your computer and use it in GitHub Desktop.
Application cookbook overriding the default options for nginx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cookbook 'nginx-app', '~> 0.1.0', path: 'cookbooks/nginx-app' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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