-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnginx_example.conf
More file actions
34 lines (28 loc) · 1018 Bytes
/
nginx_example.conf
File metadata and controls
34 lines (28 loc) · 1018 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Nginx 설정 예시
# /etc/nginx/sites-available/myapp 파일에 사용
server {
listen 80;
listen [::]:80;
server_name _;
# FastAPI가 기본으로 찾는 스키마 경로를 /api/openapi.json으로 연결
location = /openapi.json {
proxy_pass http://127.0.0.1:8000/api/openapi.json;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
# /api/* 는 FastAPI로 그대로 전달 (prefix 유지)
location /api/ {
proxy_pass http://127.0.0.1:8000;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location / {
return 200 "nginx ok\napi is /api\n";
add_header Content-Type text/plain;
}
}