forked from rapidpro/ureport
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nginx.conf
159 lines (128 loc) · 3.73 KB
/
nginx.conf
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
upstream ureport_server {
server 127.0.0.1:8025 fail_timeout=240;
}
server {
listen 8825 default;
server_name ureport.nyaruka.com ureport.staging.nyaruka.com *.ureport.in ureport.in *.ureport.staging.nyaruka.com;
error_log /var/log/nginx/ureport_error.log;
access_log /var/log/nginx/ureport_access.log;
client_max_body_size 4G;
keepalive_timeout 240;
send_timeout 240;
gzip on;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_min_length 1100;
gzip_buffers 4 8k;
gzip_proxied any;
gzip_types text/plain text/xml application/xml application/xml+rss text/css text/javascript application/javascript application/json;
gzip_static on;
gzip_proxied expired no-cache no-store private auth;
gzip_disable "MSIE [1-6]\.";
gzip_vary on;
location /users/login/ {
rewrite ^(.*) https://$host$1 permanent;
}
location /sitestatic/ {
root /home/ureport/live/;
proxy_buffers 256 16k;
proxy_buffer_size 32k;
expires max;
}
location /media/ {
root /home/ureport/live/;
proxy_buffers 256 16k;
proxy_buffer_size 32k;
expires max;
}
location / {
proxy_redirect off;
proxy_read_timeout 300s;
proxy_buffers 256 16k;
proxy_buffer_size 32k;
proxy_intercept_errors on;
set $my_host $http_host;
if ($http_user_agent ~ ELB){
set $my_host ureport.in;
}
proxy_set_header Host $my_host;
if (!-f $request_filename) {
proxy_pass http://ureport_server;
break;
}
}
# redirect server error pages to the static page
error_page 502 503 504 /error.html;
location = /favicon.ico {
root /home/ureport/live/sitestatic;
}
location = /error.html {
root /home/ureport/live/config/;
}
location = /logo.png {
root /home/ureport/live/config/;
}
location = /version.txt {
root /home/ureport/live;
}
}
server {
listen 8425 default;
server_name ureport.nyaruka.com ureport.staging.nyaruka.com *.ureport.in ureport.in *.ureport.staging.nyaruka.com;
error_log /var/log/nginx/ureport_ssl_error.log;
access_log /var/log/nginx/ureport_ssl_access.log postdata;
client_max_body_size 4G;
keepalive_timeout 240;
send_timeout 240;
gzip on;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_min_length 1100;
gzip_buffers 4 8k;
gzip_proxied any;
gzip_types text/plain text/xml application/xml application/xml+rss text/css text/javascript application/javascript application/json;
gzip_static on;
gzip_proxied expired no-cache no-store private auth;
gzip_disable "MSIE [1-6]\.";
gzip_vary on;
location /sitestatic/ {
root /home/ureport/live/;
proxy_buffers 256 16k;
proxy_buffer_size 32k;
expires max;
}
location /media/ {
root /home/ureport/live/;
proxy_buffers 256 16k;
proxy_buffer_size 32k;
expires max;
}
location / {
proxy_redirect off;
proxy_read_timeout 300s;
proxy_buffers 256 16k;
proxy_buffer_size 32k;
proxy_intercept_errors on;
proxy_set_header X-Forwarded-Proto HTTPS;
set $my_host $http_host;
if ($http_user_agent ~ ELB){
set $my_host ureport.in;
}
proxy_set_header Host $my_host;
if (!-f $request_filename) {
proxy_pass http://ureport_server;
break;
}
}
# redirect server error pages to the static page
error_page 502 503 504 /error.html;
location = /error.html {
root /home/ureport/live/config;
}
location = /logo.png {
root /home/ureport/live/config;
}
location = /version.txt {
root /home/ureport/live;
}
}