forked from mtusi2026/mtusi2026lab5
Add 4 lab code
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
worker_processes 1;
|
||||
worker_shutdown_timeout 8s;
|
||||
events { worker_connections 1024; }
|
||||
http {
|
||||
upstream messenger {
|
||||
zone messenger 64k;
|
||||
include /etc/nginx/ready-backends.conf;
|
||||
}
|
||||
log_format upstream '$request_method $uri $status upstream=$upstream_addr '
|
||||
'upstream_status=$upstream_status time=$request_time';
|
||||
access_log /var/log/nginx/access.log upstream;
|
||||
server {
|
||||
listen 8080;
|
||||
# API enforces the byte limit and returns the contracted JSON error.
|
||||
client_max_body_size 0;
|
||||
client_body_timeout 5s;
|
||||
client_header_timeout 5s;
|
||||
keepalive_timeout 5s;
|
||||
location / {
|
||||
proxy_pass http://messenger;
|
||||
proxy_http_version 1.1;
|
||||
proxy_request_buffering off;
|
||||
proxy_buffering off;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header Connection close;
|
||||
proxy_connect_timeout 1s;
|
||||
proxy_send_timeout 35s;
|
||||
proxy_read_timeout 120s;
|
||||
# A 503 is an API response (for example, S3 is unavailable), so
|
||||
# preserve it for the client instead of marking every replica down.
|
||||
proxy_next_upstream error timeout http_502 http_504;
|
||||
proxy_next_upstream_tries 2;
|
||||
proxy_next_upstream_timeout 8s;
|
||||
# Never transparently retry a POST already sent to an API.
|
||||
# A client retries messages using the original Idempotency-Key.
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user