Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

setting nginx defaults with passenger

  • Loading branch information...
commit ad5eade9e393ac176cf7e496b6824137c74b8d3d 1 parent 82a3fb0
Paulo Fagiani authored
39  lib/passenger.sh
@@ -8,3 +8,42 @@ function install_passenger_with_nginx {
8 8
 passenger_root /usr/lib/phusion-passenger;
9 9
 EOF
10 10
 }
  11
+
  12
+function set_default_nginx_config_with_passenger {
  13
+  cat <<EOF > /etc/nginx/sites-available/default
  14
+worker_processes 6;
  15
+
  16
+events {
  17
+    worker_connections  1024;
  18
+}
  19
+
  20
+http {
  21
+  passenger_root /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11;
  22
+  passenger_ruby /usr/local/bin/ruby;
  23
+
  24
+  include           mime.types;
  25
+  default_type      application/octet-stream;
  26
+  sendfile          on;
  27
+  keepalive_timeout 65;
  28
+
  29
+  server {
  30
+    listen 80;
  31
+    server_name $DOMAIN_NAME;
  32
+    root /home/app/production/current/public;
  33
+    passenger_enabled on;
  34
+    access_log logs/app.access.log;
  35
+    error_log logs/app.error.log;
  36
+    gzip  on;
  37
+    gzip_http_version 1.1;
  38
+    gzip_comp_level 6;
  39
+    gzip_proxied any;
  40
+    gzip_min_length  1024;
  41
+    gzip_buffers 16 8k;
  42
+    gzip_types text/plain text/html text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
  43
+    gzip_vary on;
  44
+    gzip_disable “MSIE [1-6].(?!.*SV1)”;
  45
+  }
  46
+}
  47
+EOF
  48
+/etc/init.d/nginx restart
  49
+}
1  recipes/rails
@@ -25,6 +25,7 @@ function install_rails {
25 25
 	update_rubygems
26 26
 	install_passenger_with_nginx
27 27
         set_rails_production_environment
  28
+        set_default_nginx_config_with_passenger
28 29
 	install_bundler
29 30
 	install_bluepill
30 31
 	install_redis

0 notes on commit ad5eade

Please sign in to comment.
Something went wrong with that request. Please try again.