Skip to content

Instantly share code, notes, and snippets.

@krasio
Created October 30, 2012 08:40
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krasio/3979033 to your computer and use it in GitHub Desktop.
Save krasio/3979033 to your computer and use it in GitHub Desktop.
Simple Chef recipe to customize Nginx configuration on Engine Yard App Cloud
# cookbooks/nginx-custom/templates/default/custom.conf.erb
rewrite ^/members/(.*)/blog_entries/(.*)$ /members/$1/blog/$2 permanent;
# cookbooks/nginx-custom/recipes/default.rb
#
# Cookbook Name: nginx-custom
# Recipe: default
#
if (['app_master', 'app'].include?(node[:instance_role]))
node[:engineyard][:environment][:apps].each do |app|
template "/etc/nginx/servers/#{app[:name]}/custom.conf" do
source 'custom.conf.erb'
owner node[:users][0][:username]
group node[:users][0][:username]
mode 0644
end
execute "sudo /etc/init.d/nginx reload"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment