forked from mtusi2026/mtusi2026lab3
44 lines
1.1 KiB
Nginx Configuration File
44 lines
1.1 KiB
Nginx Configuration File
worker_processes 1;
|
|
error_log /dev/stderr warn;
|
|
pid /var/run/nginx.pid;
|
|
|
|
events {
|
|
worker_connections 1024;
|
|
}
|
|
|
|
http {
|
|
access_log off;
|
|
server_tokens off;
|
|
|
|
# Docker DNS; resolve updates the upstream when replicas get new IPs.
|
|
resolver 127.0.0.11 valid=1s ipv6=off;
|
|
resolver_timeout 1s;
|
|
|
|
upstream messenger {
|
|
zone messenger 64k;
|
|
# All A records of api participate in the default round-robin balancing.
|
|
server api:8080 resolve max_fails=1 fail_timeout=2s;
|
|
}
|
|
|
|
server {
|
|
listen 8080;
|
|
|
|
location / {
|
|
proxy_pass http://messenger;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host $http_host;
|
|
proxy_set_header Connection "";
|
|
|
|
proxy_connect_timeout 1s;
|
|
proxy_read_timeout 5s;
|
|
proxy_send_timeout 5s;
|
|
|
|
# Passive checks. Do NOT enable non_idempotent: an already-sent POST
|
|
# must not be resent by Nginx after an ambiguous response.
|
|
proxy_next_upstream error timeout http_503;
|
|
proxy_next_upstream_tries 2;
|
|
proxy_next_upstream_timeout 6s;
|
|
}
|
|
}
|
|
}
|