SHARE
TWEET

Untitled

a guest Mar 30th, 2013 53 Never
  1. # Disable Rails's static asset server (Apache or nginx will already do this)
  2.   config.serve_static_assets = false
  3.        
  4. upstream thin {
  5.   server '127.0.0.1:3000';
  6.   server '127.0.0.1:3001';
  7.   server '127.0.0.1:3002';
  8.   server '127.0.0.1:3003';
  9.   server '127.0.0.1:3004';
  10. }
  11.  
  12. server {
  13.   listen 80 default deferred;
  14.   # server_name example.com;
  15.   root /home/user/appname/public;
  16.  
  17.   location ^~ /assets/ {
  18.     root /home/user/appname/public;
  19.     gzip_static on;
  20.     expires max;
  21.     add_header Cache-Control public;
  22.   }
  23.  
  24.   location / {
  25.     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  26.     proxy_set_header Host $http_host;
  27.     proxy_redirect off;
  28.     proxy_pass http://thin;
  29.   }
  30.   error_page 500 502 503 504 /500.html;
  31.   client_max_body_size 4G;
  32.   keepalive_timeout 10;
  33. }
  34.        
  35. server {
  36.   listen 80 default deferred;
  37.   # server_name example.com;
  38.   root /home/user/appname/public;
  39.   try_files $uri @app;
  40.  
  41.   location ^~ /assets/ {
  42.     root /home/user/appname/public;
  43.     gzip_static on;
  44.     expires max;
  45.     add_header Cache-Control public;
  46.   }
  47.  
  48.   location @app {
  49.     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  50.     proxy_set_header Host $http_host;
  51.     proxy_redirect off;
  52.     proxy_pass http://thin;
  53.   }
  54.   error_page 500 502 503 504 /500.html;
  55.   client_max_body_size 4G;
  56.   keepalive_timeout 10;
  57. }
RAW Paste Data
Top