forked from mtusi2026/mtusi2026lab3
40 lines
1.0 KiB
Nginx Configuration File
40 lines
1.0 KiB
Nginx Configuration File
worker_processes auto;
|
|
error_log /dev/stderr warn;
|
|
pid /tmp/nginx.pid;
|
|
|
|
events {
|
|
worker_connections 4096;
|
|
}
|
|
|
|
http {
|
|
access_log off;
|
|
resolver 127.0.0.11 valid=2s ipv6=off;
|
|
resolver_timeout 2s;
|
|
|
|
upstream api_upstream {
|
|
zone api_upstream 64k;
|
|
server api:8080 resolve max_fails=1 fail_timeout=5s;
|
|
keepalive 32;
|
|
}
|
|
|
|
server {
|
|
listen 8080;
|
|
|
|
location / {
|
|
proxy_pass http://api_upstream;
|
|
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_set_header X-Forwarded-Host $host;
|
|
proxy_next_upstream error timeout http_502 http_503 http_504;
|
|
proxy_next_upstream_tries 2;
|
|
proxy_next_upstream_timeout 10s;
|
|
proxy_connect_timeout 2s;
|
|
proxy_read_timeout 10s;
|
|
proxy_send_timeout 10s;
|
|
}
|
|
}
|
|
}
|