Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 6th, 2012  |  syntax: None  |  size: 0.93 KB  |  hits: 9  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. upstream app {
  2.         server unix:/srv/app/current/tmp/sockets/unicorn.sock fail_timeout=0;
  3. }
  4. server {
  5.         listen   80;
  6.         server_name  www.app.com;
  7.         rewrite ^/(.*) http://app.com/$1 permanent;
  8. }
  9.  
  10. server {
  11.         listen 80;
  12.         client_max_body_size 2G;
  13.         server_name app.com;
  14.         keepalive_timeout 5;
  15.         root /srv/app/current/public;
  16.         access_log  off;
  17.         error_log off;
  18.  
  19.         if ($request_method !~ ^(GET|HEAD|PUT|POST|DELETE|OPTIONS)$ ){
  20.                 return 405;
  21.         }
  22.  
  23.         location ~ ^/(assets)/  {  
  24.                 gzip_static on;
  25.                 expires     max;
  26.                 add_header  Cache-Control public;
  27.         }
  28.  
  29.         location / {
  30.                 try_files $uri/index.html $uri.html $uri @app;
  31.                 error_page 404              /404.html;
  32.                 error_page 422              /422.html;
  33.                 error_page 500 502 503 504  /500.html;
  34.                 error_page 403              /403.html;
  35.         }
  36.  
  37.         location @app {
  38.                 proxy_pass http://app;
  39.         }
  40.  
  41.         location = /favicon.ico {
  42.                 expires    max;
  43.                 add_header Cache-Control public;
  44.         }
  45.  
  46.         location ~ \.php$ {
  47.                 deny  all;
  48.         }
  49.  
  50. }