forked from mtusi2026/mtusi2026lab4
58 lines
1.5 KiB
Nginx Configuration File
58 lines
1.5 KiB
Nginx Configuration File
user nginx;
|
|
worker_processes auto;
|
|
error_log /dev/stderr notice;
|
|
pid /var/run/nginx.pid;
|
|
|
|
events {
|
|
worker_connections 1024;
|
|
}
|
|
|
|
http {
|
|
resolver 127.0.0.11 valid=2s ipv6=off;
|
|
|
|
log_format structured escape=json
|
|
'{"time":"$time_iso8601","request_id":"$http_x_request_id",'
|
|
'"method":"$request_method","uri":"$request_uri","status":$status,'
|
|
'"request_time":$request_time,"upstream":"$upstream_addr",'
|
|
'"upstream_status":"$upstream_status","upstream_time":"$upstream_response_time"}';
|
|
|
|
access_log /dev/stdout structured;
|
|
|
|
upstream messenger {
|
|
zone messenger 64k;
|
|
include /etc/nginx/conf.d/upstream.conf;
|
|
keepalive 32;
|
|
}
|
|
|
|
server {
|
|
listen 8080;
|
|
client_max_body_size 11m;
|
|
|
|
location / {
|
|
proxy_pass http://messenger;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Connection "";
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
proxy_request_buffering off;
|
|
|
|
proxy_connect_timeout 1s;
|
|
proxy_send_timeout 10s;
|
|
proxy_read_timeout 10s;
|
|
proxy_next_upstream error timeout http_502 http_503 http_504;
|
|
proxy_next_upstream_tries 2;
|
|
proxy_next_upstream_timeout 3s;
|
|
}
|
|
}
|
|
|
|
server {
|
|
listen 8081;
|
|
access_log off;
|
|
|
|
location = /stub_status {
|
|
stub_status;
|
|
}
|
|
}
|
|
}
|