Permalink
Browse files

setting nginx defaults with passenger

  • Loading branch information...
1 parent 82a3fb0 commit ad5eade9e393ac176cf7e496b6824137c74b8d3d @fagiani committed Jan 21, 2012
Showing with 40 additions and 0 deletions.
  1. +39 −0 lib/passenger.sh
  2. +1 −0 recipes/rails
View
@@ -8,3 +8,42 @@ function install_passenger_with_nginx {
passenger_root /usr/lib/phusion-passenger;
EOF
}
+
+function set_default_nginx_config_with_passenger {
+ cat <<EOF > /etc/nginx/sites-available/default
+worker_processes 6;
+
+events {
+ worker_connections 1024;
+}
+
+http {
+ passenger_root /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11;
+ passenger_ruby /usr/local/bin/ruby;
+
+ include mime.types;
+ default_type application/octet-stream;
+ sendfile on;
+ keepalive_timeout 65;
+
+ server {
+ listen 80;
+ server_name $DOMAIN_NAME;
+ root /home/app/production/current/public;
+ passenger_enabled on;
+ access_log logs/app.access.log;
+ error_log logs/app.error.log;
+ gzip on;
+ gzip_http_version 1.1;
+ gzip_comp_level 6;
+ gzip_proxied any;
+ gzip_min_length 1024;
+ gzip_buffers 16 8k;
+ gzip_types text/plain text/html text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
+ gzip_vary on;
+ gzip_disable “MSIE [1-6].(?!.*SV1)”;
+ }
+}
+EOF
+/etc/init.d/nginx restart
+}
View
@@ -25,6 +25,7 @@ function install_rails {
update_rubygems
install_passenger_with_nginx
set_rails_production_environment
+ set_default_nginx_config_with_passenger
install_bundler
install_bluepill
install_redis

0 comments on commit ad5eade

Please sign in to comment.