-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnginx.conf
More file actions
108 lines (87 loc) · 2.7 KB
/
Copy pathnginx.conf
File metadata and controls
108 lines (87 loc) · 2.7 KB
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
user nginx;
worker_processes auto;
worker_rlimit_nofile 65535;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
use epoll;
multi_accept on;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 30;
server_tokens off;
types_hash_max_size 2048;
client_max_body_size 10M;
client_body_timeout 12s;
client_header_timeout 12s;
send_timeout 10s;
limit_conn_zone $binary_remote_addr zone=addr:10m;
limit_req_zone $binary_remote_addr zone=req_zone:10m rate=10r/s;
upstream backend {
server backend:8080;
}
server {
listen 80;
server_name _;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log warn;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "no-referrer-when-downgrade" always;
add_header X-XSS-Protection "1; mode=block" always;
location ~ /\.(?!well-known) {
deny all;
access_log off;
log_not_found off;
}
location ~* (^|/)\.git/ {
deny all;
access_log off;
log_not_found off;
}
location ~* /(?:\.env|composer\.json|package-lock\.json|Dockerfile)$ {
deny all;
}
limit_conn addr 4;
limit_req zone=req_zone burst=10 nodelay;
location /api/v1/ {
proxy_pass http://backend/;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Connection "";
proxy_connect_timeout 10s;
proxy_send_timeout 60s;
proxy_read_timeout 90s;
proxy_buffering on;
proxy_buffers 8 16k;
proxy_busy_buffers_size 32k;
}
location /tracks/ {
root /usr/share/nginx/html;
try_files $uri $uri/ =404;
access_log off;
add_header Accept-Ranges bytes;
add_header Cache-Control "public, max-age=31536000, immutable";
expires max;
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
gzip off;
limit_except GET HEAD {
deny all;
}
}
location / {
return 404;
}
}
}