halorgium / archangel

Magic configuration for your nginx, mongrels and god!

This URL has Read+Write access

scrooloose (author)
Thu Jun 05 17:00:03 -0700 2008
halorgium (committer)
Wed Jan 28 03:25:31 -0800 2009
commit  10287747dc0f373d245c8b98ca6bd285f4cb0f19
tree    f07fbba77259a909941276c5089126a7d72bdb83
parent  f842d1238152f71bc7c55af6cc6223350d4dec3b
archangel / views / nginx / app.erb
100644 59 lines (45 sloc) 1.198 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
server {
  listen <%= site.port %>;
 
  client_max_body_size 50M;
 
  server_name <%= site.hostnames.join(" ") %>;
 
  root <%= site.public_path %>;
 
  access_log <%= site.access_log %> main;
 
  if (-f $document_root/system/maintenance.html) {
    rewrite ^(.*)$ /system/maintenance.html last;
    break;
  }
 
  location / {
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_redirect false;
    proxy_max_temp_file_size 0;
    if (-f $request_filename) {
      break;
    }
    if (-f $request_filename/index.html) {
      rewrite (.*) $1/index.html break;
    }
 
    if (-f $request_filename.html) {
      rewrite (.*) $1.html break;
    }
 
<% if site.upstreams.any? %>
    if (!-f $request_filename) {
      proxy_pass http://<%= site.name %>;
      break;
    }
<% end %>
  }
 
  error_page 500 502 503 504 /50x.html;
  location = /50x.html {
    root <%= site.public_path %>;
  }
}
 
<% if site.aliases.any? %>
server {
  listen <%= site.port %>;
 
  client_max_body_size 50M;
 
  server_name <%= site.aliases.join(" ") %>;
  
  rewrite ^/(.*)$ <%= site.main_url %>/$1 permanent;
}
<% end %>