35 lines
851 B
Nginx Configuration File
35 lines
851 B
Nginx Configuration File
server {
|
||
listen 80;
|
||
server_name performance-appraisal.excn.top;
|
||
|
||
if ($http_x_forwarded_proto = "http") {
|
||
return 301 https://$server_name$request_uri;
|
||
}
|
||
|
||
# 🔥 API(必须放前面 + ^~)
|
||
location ^~ /api/ {
|
||
|
||
rewrite ^/api/api/(.*)$ /api/$1 break;
|
||
|
||
proxy_pass http://backend:3001/;
|
||
|
||
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 $http_x_forwarded_proto;
|
||
|
||
add_header X-Debug-API "hit-api";
|
||
}
|
||
|
||
# 前端
|
||
location / {
|
||
proxy_pass http://frontend:3000;
|
||
|
||
proxy_set_header Host $host;
|
||
|
||
proxy_http_version 1.1;
|
||
proxy_set_header Upgrade $http_upgrade;
|
||
proxy_set_header Connection "upgrade";
|
||
}
|
||
}
|