forked from adsabs/bumblebee
-
Notifications
You must be signed in to change notification settings - Fork 1
/
nginx.conf
144 lines (118 loc) · 4.7 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
daemon off;
worker_processes auto;
worker_rlimit_nofile 10000;
user nobody nogroup;
pid /tmp/nginx.pid;
events {
worker_connections 2048;
accept_mutex off; # "on" if nginx worker_processes > 1
use epoll;
}
http{
log_format main '{"remote_addr": "$remote_addr","X-Original-Forwarded-For": "$proxy_add_x_forwarded_for","X-Forwarded-For": "$remote_user","time_local": "$time_local","request": "$request","status": "$status","body_bytes_sent": "$body_bytes_sent","http_referer": "$http_referer","http_user_agent": "$http_user_agent","request_length": "$request_length","Authorization": "$http_Authorization","url-path": "$document_uri","query-string": "$query_string","X-Original-Uri": "$request_uri" ,"http_cookie": "$http_cookie","X-Amzn-Trace-Id": "$http_x_amzn_trace_id"}';
access_log /var/log/nginx/access.log main;
error_log /var/log/nginx/error.log;
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
location /ready {
access_log off;
return 200 "{\"ready\": true}";
}
location /alive {
access_log off;
return 200 "{\"alive\": true}";
}
location / {
alias /app/production/;
index index.html;
include /etc/nginx/mime.types;
expires 6M;
# forbid browsers to cache the main index and the discovery.config....js
location ^~ /discovery.config {
expires 0;
add_header Cache-Control "public";
}
location ^~ /index {
expires 0;
add_header Cache-Control "public";
}
# allow CORS requests for static files (the only thing we are serving
# right now; this is necessary for embedded applicaitons loading js
# from different urls)
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'X-BB-Api-Client-Version,Keep-Alive,User-Agent,If-Modified-Since,Cache-Control,Content-Type';
# Tell client that this pre-flight info is valid for 20 days
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain charset=UTF-8';
add_header 'Content-Length' 0;
return 204;
}
if ($request_method = 'GET') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'X-BB-Api-Client-Version,Keep-Alive,User-Agent,If-Modified-Since,Cache-Control,Content-Type';
}
}
# the rules below are for push-state
location /search {
alias /app/production/;
index index.html;
include /etc/nginx/mime.types;
try_files $uri /index.html;
}
location /abs/ {
alias /app/production/;
index index.html;
include /etc/nginx/mime.types;
try_files $uri /index.html;
}
location /user/ {
alias /app/production/;
index index.html;
include /etc/nginx/mime.types;
try_files $uri /index.html;
}
location /index/ {
alias /app/production/;
index index.html;
include /etc/nginx/mime.types;
try_files $uri /index.html;
}
location /execute-query/ {
alias /app/production/;
index index.html;
include /etc/nginx/mime.types;
try_files $uri /index.html;
}
location /public-libraries {
alias /app/production/;
index index.html;
include /etc/nginx/mime.types;
try_files $uri /index.html;
}
location /classic-form {
alias /app/production/;
index index.html;
include /etc/nginx/mime.types;
try_files $uri /index.html;
}
location /paper-form {
alias /app/production/;
index index.html;
include /etc/nginx/mime.types;
try_files $uri /index.html;
}
}
server {
listen 8080;
server_name _;
return 200;
access_log off;
}
}