Created
December 31, 2013 14:44
-
-
Save atsuya046/8197807 to your computer and use it in GitHub Desktop.
custom cookbook for install and setting nginx
This file contains hidden or 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
#repo/Berkshelf | |
cookbook 'nginx', '~> 0.1.0', path: 'site-cookbooks/nginx' |
This file contains hidden or 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
#site-cookbook/nginx/recipes/default.rb | |
package "nginx" do | |
action :install | |
end | |
service "nginx" do | |
supports :status => true, :restart => true, :reload => true | |
action [:enable, :start] | |
end | |
template "nginx.conf" do | |
path "/etc/nginx/nginx.conf" | |
source "nginx.conf.erb" | |
owner "root" | |
group "root" | |
mode 0644 | |
notifies :reload, "service[nginx]" | |
end |
This file contains hidden or 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
#site-cookbook/nginx/templates/default/nginx.conf.erb | |
user nginx; | |
worker_processes 1; | |
error_log /var/log/nginx/error.log; | |
pid /var/run/nginx.pid; | |
events { | |
worker_connections 1024; | |
} | |
http { | |
include /etc/nginx/mim.types; | |
default_type application/octet-stream; | |
server { | |
listen <%= node["nginx"]["port"] %>; | |
server_name _; | |
location / { | |
root /usr/share/nginx/html; | |
index index.html index.htm; | |
} | |
} | |
} |
This file contains hidden or 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
#repo/Vagrantfile | |
... | |
chef.add_recipe "nginx" | |
... | |
chef.json = { | |
..., | |
"nginx" => { | |
"port" => 3000, | |
} | |
} | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment