~charmers/charms/precise/rails/trunk

« back to all changes in this revision

Viewing changes to cookbooks/nginx/templates/default/site.conf.erb

  • Committer: Mark Mims
  • Date: 2013-08-29 17:47:43 UTC
  • mfrom: (9.1.5 rack)
  • Revision ID: mark.mims@canonical.com-20130829174743-ltmqllm9nkbfzqpa
merging ~pavel-pachkovskij/charms/precise/rack/trunk as per https://code.launchpad.net/~pavel-pachkovskij/charms/precise/rack/trunk/+merge/179721

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
upstream rack {
 
2
  server localhost:8080;
 
3
}
 
4
 
 
5
server {
 
6
  listen 80 default_server;
 
7
  #  server_name "";
 
8
 
 
9
  keepalive_timeout 5;
 
10
 
 
11
  root <%= node[:rack][:root] %>/current/public;
 
12
 
 
13
  access_log <%= node[:rack][:root] %>/current/log/nginx.access.log;
 
14
  error_log <%= node[:rack][:root] %>/current/log/nginx.error.log;
 
15
 
 
16
  # this rewrites all the requests to the maintenance.html
 
17
  # page if it exists in the doc root. This is for capistrano's
 
18
  # disable web task
 
19
  if (-f $document_root/maintenance.html) {
 
20
    rewrite ^(.*)$ /maintenance.html last;
 
21
    break;
 
22
  }
 
23
 
 
24
  location / {
 
25
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
 
26
    proxy_set_header Host $http_host;
 
27
 
 
28
    # If the file exists as a static file serve it directly without
 
29
    # running all the other rewite tests on it
 
30
    if (-f $request_filename) {
 
31
      break;
 
32
    }
 
33
 
 
34
    if (!-f $request_filename) {
 
35
      proxy_pass http://rack;
 
36
      break;
 
37
    }
 
38
  }
 
39
}
 
 
b'\\ No newline at end of file'