-
Notifications
You must be signed in to change notification settings - Fork 923
/
Copy pathnginx.conf
40 lines (34 loc) · 1.18 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
events {
worker_connections 4096; # Adjust based on server capacity
}
http {
access_log off; # Disable access logging
error_log /var/log/nginx/error.log;
upstream api {
server api1:4100;
server api2:4200;
keepalive 128; # Increase keepalive connections
}
gzip on; # Enable gzip compression
gzip_comp_level 5; # Compression level (adjust as needed)
gzip_min_length 256; # Minimum size to compress (adjust as needed)
gzip_types text/plain text/css application/json application/javascript application/xml; # Compress specific MIME types
server {
listen 9999 backlog=4096;
location / {
proxy_pass http://api;
proxy_http_version 1.1;
proxy_set_header Connection ""; # Enable keepalive connections to upstream servers
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;
}
# Adjust buffer sizes for better performance
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
proxy_max_temp_file_size 0;
proxy_temp_file_write_size 256k; # Adjusted value
}
}