Files
tyc-webview-v2/server/部署说明-tianyuandb.md
2026-02-28 12:45:13 +08:00

1.6 KiB
Raw Blame History

天远数据 tianyuandb.com SEO 部署说明

1. 生成 tianyuandb 用 SEO 模板

在项目根目录或 server 目录执行(使用当前站点域名生成 canonical/og:url

cd server
SEO_BASE_URL=https://www.tianyuandb.com node generate-seo-templates.cjs

会在 public/seo-templates/ 下生成 15 个 HTML 文件,内容里的链接均为 https://www.tianyuandb.com

2. 上传模板到服务器

tydata-webview-v2/public/seo-templates/ 整个目录上传到服务器,目标路径:

/www/sites/www.tianyuandb.com/index/seo-templates/

即与站点 root 同级,保证存在:
/www/sites/www.tianyuandb.com/index/seo-templates/index.html
historyQuery.htmlagent.htmlagent-promote.html 等。

3. 使用 Nginx 配置

  • 配置文件:server/nginx-www.tianyuandb.com.conf
  • 复制该文件内容到线上 Nginx 对应站点的 server 配置(或直接替换该站点的 server 块,注意先备份)。
  • 确认以下路径与你的环境一致,按需修改:
    • root /www/sites/www.tianyuandb.com/index
    • ssl_certificate / ssl_certificate_key
    • include /www/sites/www.tianyuandb.com/redirect/*.conf
    • proxy_pass http://127.0.0.1:21004API 端口)

重载 Nginx

nginx -t && nginx -s reload

4. 验证

# 应返回带 title/description 的 HTML且响应头含 X-SEOMiddleware
curl -sI -A "Baiduspider/2.0" https://www.tianyuandb.com/
curl -s -A "Baiduspider/2.0" https://www.tianyuandb.com/ | grep -o '<title>.*</title>'

看到正确标题和 X-SEOMiddleware: nginx-prerendered 即表示 SEO 已生效。