-
-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathnginx.conf
97 lines (77 loc) · 2.77 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
# Run as a less privileged user for security reasons.
user nginx;
# #worker_threads to run;
# "auto" sets it to the #CPU_cores available in the system, and
# offers the best performance.
worker_processes auto;
events { worker_connections 1024; }
http {
include mime.types;
limit_req_zone $http_x_forwarded_for zone=mylimit:10m rate=3r/s;
log_format compression '[$time_local] "$http_x_forwarded_for" - '
'$status "$request" '
'"$http_referer" "$http_user_agent" - $body_bytes_sent';
server {
listen 80;
listen [::]:80;
root /var/www/data;
index index.html;
access_log /var/log/nginx/access_masz.log compression;
access_log /dev/stdout compression;
location ~ /\.ht {
deny all;
}
location ^~ /signin-discord {
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $http_x_forwarded_for;
proxy_pass http://backend:8080;
}
location ^~ /static/version.json {
add_header Cache-Control "no-cache, no-store, must-revalidate";
add_header Pragma "no-cache";
add_header Expires "1";
try_files $uri =404;
}
location ^~ /static/patchnotes.json {
add_header Cache-Control "no-cache, no-store, must-revalidate";
add_header Pragma "no-cache";
add_header Expires "1";
try_files $uri =404;
}
location ^~ /static {
add_header Cache-Control public;
add_header Cache-Control max-age=4200;
try_files $uri =404;
}
location /legal.html {
rewrite ^ /static/legal.html break;
}
location /favicon.ico {
rewrite ^ /static/favicon.ico break;
}
location /robots.txt {
rewrite ^ /static/robots.txt break;
}
location ^~ /api {
limit_req zone=mylimit burst=20 nodelay;
client_max_body_size 0;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $http_x_forwarded_for;
proxy_pass http://backend:8080;
}
location ~* \.(js|jpg|png|css|map|js.map)$ {
add_header Cache-Control public;
add_header Cache-Control max-age=4200;
try_files $uri =404;
}
location / {
if ($http_user_agent ~* ".*Discordbot.*") {
rewrite ^ /api/v1/embed?url=$uri last;
}
add_header Cache-Control "no-cache, no-store, must-revalidate";
add_header Pragma "no-cache";
add_header Expires "1";
try_files $uri $uri/ /index.html;
}
}
}