post deployment
本地来源:seo-llm/skill/google-seo-skill/references/post-deployment.md
部署后 SEO 检查
本文档包含 上线部署后 才需要执行的检查项目。 这些检查需要访问生产环境的实际域名。
1. HTTPS/SSL 证书检查
ssl_checklist:
certificate:
- "SSL 证书已正确安装"
- "证书未过期(检查有效期)"
- "证书覆盖所有子域名(包括 www)"
- "证书链完整(中间证书已安装)"
- "使用 TLS 1.2 或 TLS 1.3(禁用 TLS 1.0/1.1)"
verification_commands:
check_cert: |
openssl s_client -connect example.com:443 -servername example.com 2>/dev/null | openssl x509 -noout -dates -subject
check_tls_version: |
curl -sI --tlsv1.2 https://example.com | head -1
check_cert_chain: |
openssl s_client -connect example.com:443 -servername example.com 2>/dev/null | grep -E "depth|verify"
2. HTTP → HTTPS 重定向
redirect_checklist:
must:
- "所有 HTTP 请求 301 重定向到 HTTPS"
- "重定向目标使用正确的域名(www 或 non-www)"
- "重定向保留原始路径和查询参数"
- "无重定向循环"
- "重定向链不超过 2 跳"
verification:
http_to_https: |
curl -sIL http://example.com 2>&1 | grep -E "HTTP/|Location:"
www_redirect: |
curl -sIL http://www.example.com 2>&1 | grep -E "HTTP/|Location:"
path_preservation: |
curl -sI http://example.com/some-page 2>&1 | grep "Location:"
implementation:
next_js: |
// next.config.js
module.exports = {
async redirects() {
return [] // Next.js 在 Vercel 上自动处理 HTTPS
},
}
nginx: |
server {
listen 80;
server_name example.com www.example.com;
return 301 https://example.com$request_uri;
}
cloudflare: "在 SSL/TLS 设置中启用 'Always Use HTTPS'"
3. 安全响应头
security_headers:
required:
- header: "Strict-Transport-Security (HSTS)"
value: "max-age=31536000; includeSubDomains; preload"
purpose: "强制浏览器使用 HTTPS 连接"
- header: "X-Content-Type-Options"
value: "nosniff"
purpose: "防止 MIME 类型嗅探攻击"
- header: "X-Frame-Options"
value: "DENY 或 SAMEORIGIN"
purpose: "防止点击劫持攻击"
recommended:
- header: "Content-Security-Policy"
purpose: "防止 XSS 和代码注入"
- header: "Referrer-Policy"
value: "strict-origin-when-cross-origin"
purpose: "控制 Referer 头的发送"
- header: "Permissions-Policy"
purpose: "控制浏览器功能的使用"
verification: |
curl -sI https://example.com | grep -iE "strict-transport|x-content-type|x-frame|content-security|referrer-policy"
Next.js 安全头配置
// next.config.js
module.exports = {
async headers() {
return [
{
source: '/(.*)',
headers: [
{
key: 'Strict-Transport-Security',
value: 'max-age=31536000; includeSubDomains; preload',
},
{
key: 'X-Content-Type-Options',
value: 'nosniff',
},
{
key: 'X-Frame-Options',
value: 'SAMEORIGIN',
},
{
key: 'Referrer-Policy',
value: 'strict-origin-when-cross-origin',
},
],
},
]
},
}
4. www 规范化
www_normalization:
choose_one: "www.example.com 或 example.com(选定后保持一致)"
checklist:
- "所有页面使用同一格式(www 或 non-www)"
- "另一个格式 301 重定向到选定格式"
- "Search Console 中设置首选域名"
- "sitemap 中的 URL 使用选定格式"
- "canonical URL 使用选定格式"
- "内部链接全部使用选定格式"
verification: |
# 检查 www → non-www 重定向
curl -sI https://www.example.com | grep -E "HTTP/|Location:"
# 或 non-www → www 重定向
curl -sI https://example.com | grep -E "HTTP/|Location:"
5. 混合内容检查
mixed_content:
description: "HTTPS 页面加载 HTTP 资源会触发混合内容警告"
check_items:
- "图片 src 使用 HTTPS 或相对路径"
- "CSS/JS 引用使用 HTTPS"
- "字体文件使用 HTTPS"
- "API 请求使用 HTTPS"
- "iframe src 使用 HTTPS"
- "第三方脚本使用 HTTPS"
detection:
browser: "Chrome DevTools → Console → 查看 Mixed Content 警告"
cli: |
# 检查页面中的 HTTP 引用
curl -s https://example.com | grep -oP 'http://[^"'"'"'\s>]+' | sort -u
fix:
- "将所有 HTTP 引用改为 HTTPS"
- "使用协议相对 URL(//example.com/resource)"
- "设置 Content-Security-Policy: upgrade-insecure-requests"
6. noindex 残留检查
noindex_residual:
description: "开发/预发布环境的 noindex 标签未在生产环境移除"
check_items:
- "检查 <meta name='robots' content='noindex'>"
- "检查 HTTP 响应头 X-Robots-Tag: noindex"
- "检查 robots.txt 是否阻止重要路径"
verification:
meta_tag: |
curl -s https://example.com | grep -i "noindex"
http_header: |
curl -sI https://example.com | grep -i "x-robots-tag"
robots_txt: |
curl -s https://example.com/robots.txt
common_mistakes:
- "Vercel Preview 部署自动添加 noindex(正常行为)"
- "环境变量配置错误导致生产环境使用 noindex"
- "robots.txt 从开发环境复制未修改"
7. DNS 配置检查
dns_checklist:
- "A/AAAA 记录正确指向生产服务器"
- "CNAME 记录正确配置"
- "MX 记录正常(不影响 SEO 但影响信任度)"
- "TXT 记录包含 SPF/DKIM/DMARC(邮件安全)"
- "DNS 传播完成(全球解析一致)"
verification: |
# 检查 A 记录
dig +short example.com A
# 检查 CNAME
dig +short www.example.com CNAME
# 检查 DNS 传播
dig @8.8.8.8 example.com A
dig @1.1.1.1 example.com A
8. Search Console 验证
post_deploy_search_console:
steps:
1: "验证网站所有权"
2: "提交 sitemap.xml"
3: "请求索引重要页面"
4: "检查索引覆盖率报告"
5: "确认无手动操作通知"
monitoring:
first_week:
- "每天检查索引覆盖率变化"
- "监控抓取错误"
- "确认 Core Web Vitals 数据开始收集"
first_month:
- "对比部署前后的流量变化"
- "检查关键页面的排名变化"
- "确认所有结构化数据被识别"
9. 生产环境 SEO 验证清单
production_verification:
critical:
- "[ ] HTTPS 正常工作,证书有效"
- "[ ] HTTP → HTTPS 301 重定向正常"
- "[ ] www 规范化重定向正常"
- "[ ] 无 noindex 残留"
- "[ ] robots.txt 允许抓取重要页面"
- "[ ] sitemap.xml 可正常访问"
important:
- "[ ] 安全响应头已配置"
- "[ ] 无混合内容警告"
- "[ ] DNS 解析正常"
- "[ ] Search Console 已验证并提交 sitemap"
- "[ ] PageSpeed Insights 评分达标"
nice_to_have:
- "[ ] HSTS Preload 已提交"
- "[ ] CDN 缓存正常工作"
- "[ ] 错误页面(404/500)正确配置"
- "[ ] 国际化 hreflang 标签正确"
10. HTTPS/TLS 安全加固详解
以下是对上述 1-3 节的深度补充,涵盖 TLS 配置、证书透明度、HSTS Preload 等高级主题。
TLS 版本强制
tls_hardening:
mandatory:
- "强制使用 TLS 1.2 或 TLS 1.3"
- "完全禁用 TLS 1.0 和 TLS 1.1(已被所有主流浏览器废弃)"
- "禁用 SSL 2.0 和 SSL 3.0"
tls_1_3_advantages:
- "握手速度更快(1-RTT vs 2-RTT)"
- "更强的前向保密(Forward Secrecy)"
- "移除不安全的加密套件(RC4、3DES、SHA-1)"
- "0-RTT 恢复连接(提升性能)"
cipher_suite_recommendation:
tls_1_3: "TLS_AES_256_GCM_SHA384, TLS_AES_128_GCM_SHA256, TLS_CHACHA20_POLY1305_SHA256"
tls_1_2: "ECDHE-RSA-AES256-GCM-SHA384, ECDHE-RSA-AES128-GCM-SHA256"
avoid: "RC4, 3DES, CBC mode ciphers, export ciphers"
# Nginx TLS 加固配置
server {
listen 443 ssl http2;
server_name example.com;
# 证书配置
ssl_certificate /etc/ssl/certs/example.com.crt;
ssl_certificate_key /etc/ssl/private/example.com.key;
# TLS 版本控制
ssl_protocols TLSv1.2 TLSv1.3;
# 加密套件(TLS 1.2)
ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256';
ssl_prefer_server_ciphers on;
# OCSP Stapling(加速证书验证)
ssl_stapling on;
ssl_stapling_verify on;
resolver 8.8.8.8 1.1.1.1 valid=300s;
# Session 优化
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 1d;
ssl_session_tickets off;
}
证书链与证书透明度(CT)
certificate_transparency:
description: "CT 是 Google 推动的公开日志系统,记录所有已签发的 SSL 证书"
importance:
- "Chrome 要求所有 2018 年 4 月后签发的证书必须有 CT 日志"
- "缺少 CT 记录的证书会触发浏览器警告"
- "CT 帮助域名所有者发现未授权的证书签发"
verification:
check_ct_logs: |
# 检查证书是否包含 SCT(Signed Certificate Timestamp)
openssl s_client -connect example.com:443 -servername example.com 2>/dev/null | \
openssl x509 -noout -text | grep -A 5 "CT Precertificate"
check_online: "访问 https://crt.sh/?q=example.com 查看证书签发记录"
cert_chain_validation:
checklist:
- "确保中间证书(Intermediate CA)已正确安装"
- "证书链顺序正确:站点证书 → 中间证书 → 根证书"
- "使用 SSL Labs(ssllabs.com/ssltest)验证证书链完整性"
- "证书链不完整会导致部分设备/浏览器连接失败"
common_issues:
- "缺少中间证书 → 移动端 Android 浏览器报错"
- "证书过期 → 所有浏览器显示安全警告"
- "域名不匹配 → NET::ERR_CERT_COMMON_NAME_INVALID"
- "自签名证书 → 不被搜索引擎信任"
HSTS Preload 提交流程
hsts_preload:
description: "将域名加入浏览器内置的 HSTS 列表,确保首次访问也使用 HTTPS"
prerequisites:
- "有效的 SSL 证书"
- "所有 HTTP 请求 301 重定向到 HTTPS"
- "所有子域名都支持 HTTPS"
- "HSTS 头包含 includeSubDomains 和 preload 指令"
- "max-age 至少 31536000(1年)"
required_header: "Strict-Transport-Security: max-age=63072000; includeSubDomains; preload"
submission_steps:
1: "确认所有前提条件已满足"
2: "访问 https://hstspreload.org"
3: "输入域名并提交"
4: "等待审核(通常数周到数月)"
5: "一旦加入列表,移除非常困难,请确认无误后再提交"
warnings:
- "⚠️ 加入 HSTS Preload 后,所有子域名都必须支持 HTTPS"
- "⚠️ 移除需要同样漫长的审核过程"
- "⚠️ 确保没有仅 HTTP 的内部服务使用子域名"
安全重定向链验证
secure_redirect_validation:
rules:
- "HTTP → HTTPS 重定向必须是 301(永久重定向)"
- "重定向链不超过 2 跳(理想为 1 跳)"
- "避免 HTTP → HTTP → HTTPS 的链式重定向"
- "确保每一跳都保留原始路径和查询参数"
common_redirect_patterns:
correct:
- "http://example.com → 301 → https://example.com(1跳)"
- "http://www.example.com → 301 → https://example.com(1跳)"
problematic:
- "http://www.example.com → http://example.com → https://example.com(2跳,且第一跳未加密)"
- "http://example.com → 302 → https://example.com(302 不传递 SEO 权重)"
verification_script: |
# 完整的重定向链检测
for url in "http://example.com" "http://www.example.com" "https://www.example.com"; do
echo "=== Testing: $url ==="
curl -sIL "$url" 2>&1 | grep -E "HTTP/|Location:|Strict-Transport"
echo ""
done
mixed_content_deep_scan:
description: "部署后深度扫描混合内容"
tools:
- "Chrome DevTools → Security Tab → 查看混合内容详情"
- "CSP 报告模式:Content-Security-Policy-Report-Only: default-src https:; report-uri /csp-report"
- "自动化工具:npx is-website-vulnerable https://example.com"
fix_strategy:
- "设置 Content-Security-Policy: upgrade-insecure-requests 作为临时方案"
- "逐步替换所有 HTTP 资源引用为 HTTPS"
- "第三方脚本无 HTTPS 版本时考虑自托管或替换"
相关文档
- Google Search Console 集成 — 部署后索引监控与验证
- 技术 SEO — 爬虫控制与索引优化 — robots.txt 与 sitemap 配置
- 性能优化与 Core Web Vitals — 上线后性能指标验证
- SEO 问题排查 — 部署后常见问题诊断
- SEO 工具与资源 — 部署验证工具与审计清单
本文档为站内渲染。原始文件本地路径:saas/source/seo-llm/skill-google-seo-skill-references-post-deployment-c91e7c.md(仅本地保留,不入库不部署)