forked from mtusi2026/mtusi2026lab3
36 lines
1.2 KiB
Nginx Configuration File
36 lines
1.2 KiB
Nginx Configuration File
worker_processes 1;
|
|
worker_shutdown_timeout 6s;
|
|
events { worker_connections 1024; }
|
|
http {
|
|
resolver 127.0.0.11 valid=1s ipv6=off;
|
|
resolver_timeout 1s;
|
|
log_format lab '$time_iso8601 $request_method $uri $status upstream=$upstream_addr '
|
|
'instance=$upstream_http_x_instance_id time=$request_time';
|
|
access_log /dev/stdout lab;
|
|
error_log /dev/stderr warn;
|
|
upstream api {
|
|
zone api 64k;
|
|
include /etc/nginx/upstreams.conf;
|
|
}
|
|
server {
|
|
listen 8080;
|
|
client_max_body_size 1m;
|
|
client_body_timeout 5s;
|
|
location / {
|
|
proxy_pass http://api;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Connection close;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Request-Id $http_x_request_id;
|
|
proxy_connect_timeout 1s;
|
|
proxy_read_timeout 5s;
|
|
proxy_send_timeout 5s;
|
|
proxy_next_upstream error timeout http_502 http_503 http_504;
|
|
proxy_next_upstream_tries 2;
|
|
proxy_next_upstream_timeout 6s;
|
|
# Do not enable non_idempotent: uncertain POST is retried by the
|
|
# client with the ORIGINAL key; chats and registration are unsafe.
|
|
}
|
|
}
|
|
}
|