f
This commit is contained in:
@@ -9,7 +9,7 @@ server
|
||||
listen [::]:80;
|
||||
server_name zhinengcha.cn www.zhinengcha.cn p.zhenaicha.cn;
|
||||
index index.html index.htm default.htm default.html;
|
||||
root /www/wwwroot/zhinengcha.cn/dist;
|
||||
root /www/wwwroot/zhinengcha.cn;
|
||||
#CERT-APPLY-CHECK--START
|
||||
# 用于SSL证书申请时的文件验证相关配置 -- 请勿删除并保持这段设置在优先级高的位置
|
||||
include /www/server/panel/vhost/nginx/well-known/zhinengcha.cn.conf;
|
||||
@@ -50,72 +50,65 @@ server
|
||||
location ~ \.well-known{
|
||||
allow all;
|
||||
}
|
||||
|
||||
|
||||
# API 代理
|
||||
location /api/v1 {
|
||||
proxy_pass http://127.0.0.1:21004;
|
||||
proxy_set_header Host 127.0.0.1:$server_port;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header REMOTE-HOST $remote_addr;
|
||||
add_header X-Cache $upstream_cache_status;
|
||||
proxy_set_header X-Host $host:$server_port;
|
||||
proxy_set_header X-Scheme $scheme;
|
||||
proxy_connect_timeout 30s;
|
||||
proxy_read_timeout 86400s;
|
||||
proxy_send_timeout 30s;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_pass http://127.0.0.1:21004;
|
||||
proxy_set_header Host 127.0.0.1:$server_port;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header REMOTE-HOST $remote_addr;
|
||||
add_header X-Cache $upstream_cache_status;
|
||||
proxy_set_header X-Host $host:$server_port;
|
||||
proxy_set_header X-Scheme $scheme;
|
||||
proxy_connect_timeout 30s;
|
||||
proxy_read_timeout 86400s;
|
||||
proxy_send_timeout 30s;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
}
|
||||
|
||||
# 前端路由处理 - 爬虫检测返回静态SEO页面
|
||||
location / {
|
||||
set $seo_page 0;
|
||||
set $is_bot 0;
|
||||
# 检测常见爬虫 User-Agent
|
||||
if ($http_user_agent ~* "(baiduspider|googlebot|bingbot|msnbot|360spider|sogou|youdaobot|twitterbot|facebookexternalhit|linkedinbot|bytespider)") {
|
||||
set $seo_page 1;
|
||||
set $is_bot 1;
|
||||
}
|
||||
# 如果是爬虫且是首页
|
||||
if ($seo_page = 1) {
|
||||
# 爬虫访问各页面返回对应 SEO 模板
|
||||
if ($is_bot = 1) {
|
||||
rewrite ^/$ /seo-templates/index.html last;
|
||||
}
|
||||
# 如果是爬虫且是其他页面
|
||||
if ($seo_page = 1) {
|
||||
if ($is_bot = 1) {
|
||||
rewrite ^/agent$ /seo-templates/agent.html last;
|
||||
}
|
||||
if ($seo_page = 1) {
|
||||
if ($is_bot = 1) {
|
||||
rewrite ^/help$ /seo-templates/help.html last;
|
||||
}
|
||||
if ($seo_page = 1) {
|
||||
if ($is_bot = 1) {
|
||||
rewrite ^/help/guide$ /seo-templates/help-guide.html last;
|
||||
}
|
||||
if ($seo_page = 1) {
|
||||
if ($is_bot = 1) {
|
||||
rewrite ^/example$ /seo-templates/example.html last;
|
||||
}
|
||||
if ($seo_page = 1) {
|
||||
if ($is_bot = 1) {
|
||||
rewrite ^/service$ /seo-templates/service.html last;
|
||||
}
|
||||
if ($seo_page = 1) {
|
||||
if ($is_bot = 1) {
|
||||
rewrite ^/inquire/riskassessment$ /seo-templates/inquire-riskassessment.html last;
|
||||
}
|
||||
if ($seo_page = 1) {
|
||||
if ($is_bot = 1) {
|
||||
rewrite ^/inquire/companyinfo$ /seo-templates/inquire-companyinfo.html last;
|
||||
}
|
||||
if ($seo_page = 1) {
|
||||
if ($is_bot = 1) {
|
||||
rewrite ^/inquire/marriage$ /seo-templates/inquire-marriage.html last;
|
||||
}
|
||||
if ($seo_page = 1) {
|
||||
if ($is_bot = 1) {
|
||||
rewrite ^/promote$ /seo-templates/promote.html last;
|
||||
}
|
||||
# 普通用户返回 SPA
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
# SEO 静态模板目录
|
||||
location /seo-templates {
|
||||
root /www/wwwroot/zhinengcha.cn/dist;
|
||||
internal;
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
#禁止在证书验证目录放入敏感文件
|
||||
|
||||
Reference in New Issue
Block a user