kgrabko commited on
Commit
14d56d5
·
verified ·
1 Parent(s): 570557d

Create cluster/nginx.conf

Browse files
Files changed (1) hide show
  1. cluster/cluster/nginx.conf +56 -0
cluster/cluster/nginx.conf ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ events {
2
+ worker_connections 8192;
3
+ }
4
+
5
+ http {
6
+ log_format jirack_log '$remote_addr - $remote_user [$time_local] '
7
+ '"$request" $status $body_bytes_sent '
8
+ '"$http_referer" "$http_user_agent" '
9
+ 'rt=$request_time';
10
+
11
+ access_log /var/log/nginx/access.log jirack_log;
12
+ error_log /var/log/nginx/error.log warn;
13
+
14
+ # Rate limiting
15
+ limit_req_zone $binary_remote_addr zone=jirack_limit:20m rate=30r/m;
16
+
17
+ # Upstream — исправленные имена под 1B docker-compose
18
+ upstream jirack_backend {
19
+ least_conn; # Least connections — оптимально
20
+ server jirack1:7869 max_fails=3 fail_timeout=10s;
21
+ server jirack2:7869 max_fails=3 fail_timeout=10s;
22
+ server jirack3:7869 max_fails=3 fail_timeout=10s;
23
+ server jirack4:7869 max_fails=3 fail_timeout=10s;
24
+ server jirack5:7869 max_fails=3 fail_timeout=10s;
25
+ }
26
+
27
+ server {
28
+ listen 80;
29
+
30
+ location / {
31
+ limit_req zone=jirack_limit burst=15 nodelay;
32
+
33
+ proxy_pass http://jirack_backend;
34
+ proxy_http_version 1.1;
35
+ proxy_set_header Connection "";
36
+ proxy_set_header Host $host;
37
+ proxy_set_header X-Real-IP $remote_addr;
38
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
39
+ proxy_set_header X-Forwarded-Proto $scheme;
40
+
41
+ proxy_buffering off;
42
+ proxy_request_buffering off;
43
+ proxy_read_timeout 600s;
44
+ proxy_send_timeout 600s;
45
+
46
+ chunked_transfer_encoding on;
47
+ proxy_hide_header X-Powered-By;
48
+ }
49
+
50
+ # Healthcheck
51
+ location /health {
52
+ access_log off;
53
+ return 200 "healthy\n";
54
+ }
55
+ }
56
+ }