| | |
| | | # 东区人才卡 —— 站点(2026-09-22) |
| | | # 东区人才卡 —— 站点(2026-09-29) |
| | | # |
| | | # 部署位置:/etc/nginx/sites-available/talent-card (再软链到 sites-enabled/) |
| | | # 部署位置:/etc/nginx/sites-available/talent-card (软链到 sites-enabled/) |
| | | # |
| | | # 三个 server 块共用 snippets/talent-card-locations.conf, |
| | | # 所以「前端托管 + /api 反代 + /uploads 反代」只有一份定义,加端口不会漂移。 |
| | | # 端口分工: |
| | | # 8081 → **测试环境**(完整功能,用 snippets/talent-card-locations.conf) |
| | | # 80 → 只做 301 跳到 https |
| | | # 443 → 这个域名留给**生产环境**,目前**尚未部署**,所以只显示占位页 |
| | | # |
| | | # 8081:备案前的唯一入口,现在保留(堡垒机/内网调试也走它)。 |
| | | # ⚠️ 它仍然是**全公网可达的明文端口**,上面挂着后台 API;HTTPS 稳定后建议请云管理方关掉。 |
| | | # 80 :只做 301 跳转到 https。 |
| | | # 443 :正式入口。证书是华为云签发的 DV 证书(TrustAsia 签发,链:叶子 → TrustAsia DV TLS RSA CA 2025 |
| | | # → DigiCert Global Root G2),SAN 覆盖 `dqrcfwpt.com` 与 `www.dqrcfwpt.com`。 |
| | | # ssl_certificate 必须指向**含中间链的 bundle**,不能只给叶子证书。 |
| | | # 生产上线时怎么切:把下面 443 那个 server 块里的 `root` 与两个 location 换成 |
| | | # `root <生产的 dist 目录>;` + `include snippets/talent-card-locations.conf;`, |
| | | # 80 的 301 不用动。占位页在 /data/talent-card/placeholder/index.html。 |
| | | # |
| | | # 证书到期:2027-02-11。**华为云的证书不会自动续到本机**,到期前要在华为云重新下载再传一次 |
| | | # (或那时改用 Let's Encrypt —— 80 已通,certbot 一条命令且自带自动续期)。 |
| | | # |
| | | # HSTS 目前是**第一步**:max-age=86400(1 天),且**没有** includeSubDomains / preload。 |
| | | # 观察一段时间没问题后,再把 max-age 提到 31536000(1 年)。不加 includeSubDomains 的原因: |
| | | # 一旦哪天新增子域(例如 OSS 的 img.)还没配好 HTTPS,HSTS 会把那个子域也锁死;而 preload 是单向门,更难退出。 |
| | | # 第一次成功续期之后再考虑这两项。 |
| | | # 证书:华为云 DV(TrustAsia 签发),SAN 覆盖 `dqrcfwpt.com` 与 `www.dqrcfwpt.com`。 |
| | | # `/etc/nginx/ssl/talent-card/server.crt` **必须含中间链**(bundle,4451 字节)。 |
| | | # **2027-02-11 到期,且不会自动续到本机** —— 到期前重新下载再传一次。 |
| | | # HSTS 仍是第一步:max-age=86400,无 includeSubDomains / preload。 |
| | | |
| | | server { |
| | | listen 8081; |
| | |
| | | include snippets/talent-card-locations.conf; |
| | | } |
| | | |
| | | # 80:只做跳转,不再直接提供内容 |
| | | server { |
| | | listen 80; |
| | | server_name www.dqrcfwpt.com dqrcfwpt.com; |
| | |
| | | |
| | | ssl_certificate /etc/nginx/ssl/talent-card/server.crt; |
| | | ssl_certificate_key /etc/nginx/ssl/talent-card/server.key; |
| | | # 同一份 bundle:叶子 + 中间链,供 OCSP stapling 校验用 |
| | | ssl_trusted_certificate /etc/nginx/ssl/talent-card/server.crt; |
| | | |
| | | ssl_protocols TLSv1.2 TLSv1.3; |
| | |
| | | ssl_stapling on; |
| | | ssl_stapling_verify on; |
| | | |
| | | # HSTS 第一步:1 天,先观察 |
| | | add_header Strict-Transport-Security "max-age=86400" always; |
| | | |
| | | include snippets/talent-card-locations.conf; |
| | | root /data/talent-card/placeholder; |
| | | location / { |
| | | try_files $uri /index.html; |
| | | } |
| | | |
| | | # 这个域名上还没有后端。别让 /api 落到静态页上、让人以为接口可用。 |
| | | location /api/ { |
| | | default_type application/json; |
| | | return 503 '{"code":503,"message":"production not deployed"}'; |
| | | } |
| | | } |