kra-new/web/.docker-compose/nginx/conf.d/my.conf

26 lines
956 B
Plaintext
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.

server {
listen 80;
server_name localhost;
# K8s 部署proxy_pass 的服务名由 Jenkins envsubst '$KRA_APP' 渲染为 <APP_NAME>-backend
# 产物写至 web/nginx.k8s.conf不入库。本地手动构建 web 镜像前需先执行渲染。
location / {
root /usr/share/nginx/html;
add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
try_files $uri $uri/ /index.html;
}
location /api {
proxy_set_header Host $http_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;
rewrite ^/api/(.*)$ /$1 break; #重写
proxy_pass http://${KRA_APP}-backend:8000; # Kubernetes Service
}
location /api/swagger/index.html {
proxy_pass http://${KRA_APP}-backend:8000/swagger/index.html;
}
}