Skip to content

Instantly share code, notes, and snippets.

@tango238
Last active December 16, 2015 11:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tango238/5426579 to your computer and use it in GitHub Desktop.
Save tango238/5426579 to your computer and use it in GitHub Desktop.
chef nginx
{
"nginx": {
"port" : 80
},
"run_list":[
"yum::epel",
"nginx"
]
}
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
# For Local Environment
service 'iptables ' do
action [:disable, :stop]
end
user nginx;
worker_processes 1;
pid /var/run/nginx.pid;
error_log /var/log/nginx.error_log;
events {
worker_connections 2000;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
server {
listen <%= node['nginx']['port'] %>;
server_name localhost;
access_log /var/log/nginx.access_log;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment