Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- FILE #### default.rb
- %w{pcre-devel}.each do |pkg|
- package pkg do
- action :install
- not_if "rpm -qa |grep #{pkg}"
- end
- end
- service "nginx" do
- supports :restart => true, :status => true, :reload => true
- action [:enable, :start]
- not_if "ps -ef |grep nginx"
- end
- %w{/var/log/nginx/ /var/tmp/ /var/tmp/nginx/ /var/tmp/nginx/client/}.each do |dir|
- directory dir do
- mode 777
- action :create
- not_if "test -d #{dir}"
- end
- end
- if node.role?("production")
- template "/etc/nginx/nginx.conf" do
- source "offload_nginx.conf.erb"
- mode 0644
- if node.role?("frontend")
- variables ({
- :app_name => "frontend",
- :system_env => "www",
- :send_timeout => "60",
- :client_body_timeout => "60",
- :client_header_timeout => "60",
- :proxy_read_timeout => "60",
- :max_body_size => "1M"
- })
- elsif node.role?("backend")
- variables ({
- :app_name => "backend",
- :system_env => "backend",
- :send_timeout => "240",
- :client_body_timeout => "240",
- :client_header_timeout => "240",
- :proxy_read_timeout => "240",
- :max_body_size => "5M"
- })
- end
- end
- end
- ## File offload_nginx.conf.erb
- server {
- listen 80 default;
- server_name <%= @system_env %>.mydomain.com;
- client_max_body_size <%= @max_body_size %>;
- # ==========
- # Location for Unicorn
- # ==========
- root /home/nginx/<%= @app_name %>/current/public;
- }
Add Comment
Please, Sign In to add comment