我正在使用 nginx 设置代理以将不同的请求重定向到不同的端口或 url,下面列出了两个配置文件:
ingress.conf:
server {
listen 8876;
server_name 10.212.38.39;
location ^~ /legislationpinpointextraction {
proxy_pass http://10.212.38.39:8877;
}
location ^~ /legislationcitationextraction {
proxy_pass http://10.212.38.39:8877;
}
location ^~ /datementionextraction {
proxy_pass http://10.212.38.39:8877;
}
location ^~ /autonotegenerator {
proxy_http_version 1.1;
proxy_pass https://us-dev.aicat.me/;
}
}
出口.conf:
server {
listen 8877;
server_name 10.212.38.39;
location / {
root /home/jjjia/SDer/;
index index.html;
try_files $uri $uri/ /index.html;
}
location ^~ /api/legislationpinpointextraction {
proxy_pass http://10.212.38.39:6999;
}
location ^~ /api/legislationcitationextraction {
proxy_pass http://10.212.38.39:6999;
}
location ^~ /api/datementionextraction {
proxy_pass http://10.212.38.39:6999;
}
}
server {
listen 6999;
server_name 10.212.38.39;
location ^~ /api/legislationpinpointextraction {
add_header 'Access-Control-Allow-Origin' 'http://10.212.38.39:8877';
add_header 'Access-Control-Allow-Headers' '*';
add_header 'Access-Control-Allow-Methods' '*';
proxy_http_version 1.1;
proxy_pass https://ai-model.dev.caas-common.aicat.me/nlp/legislation-pinpoint-extraction/;
proxy_redirect off;
}
location ^~ /api/legislationcitationextraction {
add_header 'Access-Control-Allow-Origin' 'http://10.212.38.39:8877';
add_header 'Access-Control-Allow-Headers' '*';
add_header 'Access-Control-Allow-Methods' '*';
proxy_http_version 1.1;
proxy_pass https://ai-model.dev.caas-common.aicat.me/nlp/legislation-citation-extraction/;
proxy_redirect off;
}
location ^~ /api/datementionextraction {
add_header 'Access-Control-Allow-Origin' 'http://10.212.38.39:8877';
add_header 'Access-Control-Allow-Headers' '*';
add_header 'Access-Control-Allow-Methods' '*';
proxy_http_version 1.1;
proxy_pass https://ai-model.dev.caas-common.aicat.me/nlp/date-mention-extraction/;
proxy_redirect off;
}
}
有两个问题:
我发现是因为https://us-dev.aicat.me/被https://us-dev.aicat.me/autonotegenerator替换了所以静态文件无法生成找到了,但是我该如何更改我的配置来解决这个问题?
提前谢谢你。
我尝试手动加载静态文件,但仍然找不到它们,因为url已更改。