Files
CICD_Learning/front/nginx.conf
2025-09-02 22:44:23 +08:00

31 lines
792 B
Nginx Configuration File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
# 配置前端路由支持SPA单页应用
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
# 处理静态文件
location / {
try_files $uri $uri/ /index.html;
}
# 代理API请求到后端
location /api/ {
proxy_pass http://backend:5000/;
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;
}
}
}