FastApi-Microservices / nginx.conf
anyonehomep1mane
Initial Changes
e471cfa
worker_processes 1;
events {
worker_connections 1024;
}
http {
map $http_referer $openapi_backend {
default "";
~*/auth/ http://127.0.0.1:8001;
~*/task/ http://127.0.0.1:8002;
}
server {
listen 7860;
# Root entry (HF Space landing)
location = / {
return 302 /auth/docs;
}
# Auth service
location /auth/ {
proxy_pass http://127.0.0.1:8001/;
proxy_set_header Host $host;
}
# Task service
location /task/ {
proxy_pass http://127.0.0.1:8002/;
proxy_set_header Host $host;
}
# Swagger OpenAPI fix
location = /openapi.json {
proxy_pass $openapi_backend/openapi.json;
}
# Favicon
location = /favicon.ico {
return 204;
access_log off;
}
}
}