增加新的子官网配置以及ng
This commit is contained in:
@@ -3,9 +3,9 @@ upstream official_backend {
|
||||
server 10.0.0.15:3000; # 机器B的内网地址
|
||||
}
|
||||
|
||||
upstream newofficial_backend {
|
||||
server 10.0.0.5:3003; # 机器A的内网地址
|
||||
server 10.0.0.15:3003; # 机器B的内网地址
|
||||
upstream new_official_backend {
|
||||
server 10.0.0.5:3003;
|
||||
server 10.0.0.15:3003;
|
||||
}
|
||||
|
||||
log_format official_log '$remote_addr - $remote_user [$time_local] '
|
||||
@@ -54,14 +54,29 @@ server {
|
||||
access_log /data/tengine/logs/lessie.ai.access.log official_log;
|
||||
error_log /data/tengine/logs/lessie.ai.error.log;
|
||||
|
||||
|
||||
# 反向代理到后端服务器渲染的nxut项目端口(新框架的几个页面)
|
||||
location ~ ^/(influencer-marketing|b2b-lead-generation|investor-scouting|recruiting|partnerships) {
|
||||
# 1. 新框架的业务页面逻辑
|
||||
location ~ "^/([a-z]{2}(-[a-z]{2})?/)?(influencer-marketing|b2b-lead-generation|investor-scouting|recruiting|partnerships)" {
|
||||
proxy_pass http://new_official_backend;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
}
|
||||
|
||||
# 2. 静态资源分流 (核心逻辑)
|
||||
location ~ ^/(_next/|__nuxt/|.*\.json) {
|
||||
# 默认给老项目 (3000端口)
|
||||
set $target_upstream http://official_backend;
|
||||
|
||||
# 只有当来源页面 (Referer) 明确包含新项目的关键字时,才改发到 3003
|
||||
if ($http_referer ~* "(influencer-marketing|b2b-lead-generation|investor-scouting|recruiting|partnerships)") {
|
||||
set $target_upstream http://new_official_backend;
|
||||
}
|
||||
|
||||
proxy_pass $target_upstream;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
}
|
||||
|
||||
# 反向代理到后端服务器渲染的nxut项目3000端口(老框架的完整页面)
|
||||
location / {
|
||||
@@ -69,9 +84,21 @@ server {
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
}
|
||||
|
||||
# 禁止logo走缓存
|
||||
|
||||
location /video/ {
|
||||
root /data/tengine/html/lessie_official;
|
||||
expires 30d;
|
||||
add_header Cache-Control "public";
|
||||
add_header Accept-Ranges bytes;
|
||||
}
|
||||
|
||||
# 禁止 logo 缓存(默认给用户方形)
|
||||
location = /favicon.svg {
|
||||
# 判断 UA,如果是 Googlebot,改写路径
|
||||
if ($http_user_agent ~* "(Googlebot|Bingbot)") {
|
||||
rewrite ^/favicon.svg$ /favicon-google.svg last;
|
||||
}
|
||||
|
||||
proxy_pass http://official_backend;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
@@ -81,11 +108,9 @@ server {
|
||||
add_header Expires 0 always;
|
||||
}
|
||||
|
||||
location = /favicon.ico {
|
||||
proxy_pass http://official_backend;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
|
||||
# Googlebot 专用 favicon 文件(圆形图标)
|
||||
location = /favicon-google.svg {
|
||||
root /data/tengine/html/lessie_official;
|
||||
add_header Cache-Control "no-cache, no-store, must-revalidate" always;
|
||||
add_header Pragma "no-cache" always;
|
||||
add_header Expires 0 always;
|
||||
|
||||
@@ -70,6 +70,30 @@ server {
|
||||
}
|
||||
}
|
||||
|
||||
# email-api 的代理配置
|
||||
location /email-api/ {
|
||||
proxy_pass http://10.0.0.5:8031;
|
||||
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;
|
||||
|
||||
proxy_buffering off;
|
||||
proxy_cache off;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Connection "";
|
||||
proxy_request_buffering off;
|
||||
|
||||
add_header 'Access-Control-Allow-Origin' "$http_origin" always;
|
||||
add_header 'Access-Control-Allow-Credentials' 'true' always;
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT, DELETE' always;
|
||||
add_header 'Access-Control-Allow-Headers' 'Authorization,Content-Type,X-Requested-With,Accept,Origin' always;
|
||||
|
||||
if ($request_method = OPTIONS ) {
|
||||
return 204;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
location /api/chat/stream {
|
||||
proxy_pass http://s4_jennie_im_backend;
|
||||
|
||||
Reference in New Issue
Block a user