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
|
upstream rack {
server localhost:8080;
}
server {
listen 80 default_server;
# server_name "";
keepalive_timeout 5;
root <%= node[:rack][:root] %>/current/public;
access_log <%= node[:rack][:root] %>/current/log/nginx.access.log;
error_log <%= node[:rack][:root] %>/current/log/nginx.error.log;
# this rewrites all the requests to the maintenance.html
# page if it exists in the doc root. This is for capistrano's
# disable web task
if (-f $document_root/maintenance.html) {
rewrite ^(.*)$ /maintenance.html last;
break;
}
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
# If the file exists as a static file serve it directly without
# running all the other rewite tests on it
if (-f $request_filename) {
break;
}
if (!-f $request_filename) {
proxy_pass http://rack;
break;
}
}
}
|