-
Notifications
You must be signed in to change notification settings - Fork 923
/
Copy pathnginx.conf
64 lines (54 loc) · 2.2 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
worker_processes auto;
worker_rlimit_nofile 32768;
# worker_rlimit_nofile 20000;
events {
worker_connections 16384; # Adjusted to fit within memory constraint
# worker_connections 20000; # Adjusted to fit within memory constraint
multi_accept on; # Enable multiple accept calls to handle more connections efficiently
use epoll; # Use epoll event notification mechanism for better performance on Linux
}
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 5; # Reduced to reclaim connections faster
# Buffer sizes reduced to fit within memory constraint
# client_body_buffer_size 4k;
# client_max_body_size 10m;
# client_header_buffer_size 1k;
# large_client_header_buffers 2 1k;
client_body_buffer_size 2k;
client_max_body_size 2k;
client_header_buffer_size 1k;
large_client_header_buffers 2 1k;
# Disable logging or set to a minimal level
access_log off; # Turn off access logging to save resources
# error_log /var/log/nginx/error.log crit; # Set error log level to 'crit' for critical errors only
# Gzip compression disabled due to memory constraint
gzip off;
# Load balancing configuration for API servers
upstream api {
server api01:8080;
server api02:8080;
keepalive 500;
}
server {
listen 9999; # Lembra da porta 9999 obrigatória?
location / {
proxy_pass http://api;
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_set_header Keep-Alive "";
# proxy_set_header Proxy-Connection "keep-alive";
# Buffer requests and responses above a certain size
proxy_buffering on;
proxy_buffer_size 12k; # Buffer size for proxied request or response
proxy_buffers 4 8k; # Number and size of buffers for proxied request or response
# proxy_buffering off;
}
}
}