| | |
| | | # 东区人才卡 —— 站点(2026-09-29) |
| | | # 东区人才卡 —— 站点(2026-10-08) |
| | | # |
| | | # 部署位置:/etc/nginx/sites-available/talent-card (软链到 sites-enabled/) |
| | | # |
| | | # 【域名现状】甲方把 `www.dqrcfwpt.com` 与退域名 `dqrcfwpt.com` 指向了他们自己的机器 |
| | | # (公司官网,腾讯云 IP),所以那两个名字**已经不在我们手上**。测试环境改用新建的 |
| | | # 子域 **`rencaika.dqrcfwpt.com`**(解析到本机)。 |
| | | # |
| | | # 端口分工: |
| | | # 8081 → **测试环境(TLS 入口)**:https://www.dqrcfwpt.com:8081/ |
| | | # 8082 → **测试环境(明文兜底)**:http://117.172.73.106:8082/ (用 IP 访问时走它) |
| | | # 80 → 只做 301 跳到 https |
| | | # 443 → 这个域名留给**生产环境**,目前**尚未部署**,所以只显示占位页 |
| | | # rencaika.dqrcfwpt.com:443 → **测试环境(正式入口,不带端口)** |
| | | # rencaika.dqrcfwpt.com:8081 → 测试环境(同机兼容,TLS;小程序白名单也可以填它) |
| | | # 8082(明文,server_name _) → 测试环境兜底,给 IP 访问用(HSTS 管不到 IP,这条永远可用) |
| | | # 80 → 301 到 https(但给 ACME 校验留例外,见下) |
| | | # www/退域名 的 443 → 生产占位页(那两个名字已不在我们手上,这段是残留,可删) |
| | | # |
| | | # ⚠️ 为什么 8081 必须是 TLS、明文入口要另开一个端口: |
| | | # 443 上发了 HSTS(max-age=86400),而 **HSTS 按“主机”生效、覆盖该主机的所有端口** |
| | | # (RFC 6797 §8.3:「the HSTS Policy applies to HTTP over any TCP port of an HSTS Host」), |
| | | # 且升级时**显式端口会被保留**(`http://host:8081` → `https://host:8081`)。 |
| | | # 所以浏览器一旦收过 HSTS,`http://www.dqrcfwpt.com:8081` 就会被强制升级成 https —— |
| | | # 8081 若只说纯 HTTP,用户看到的就是“打不开”。 |
| | | # 【证书】两套并存,nginx 按 SNI 选: |
| | | # * `rencaika.dqrcfwpt.com` → Let's Encrypt(certbot 自动续期,2027-01-06 到期, |
| | | # 续期由 certbot.timer 负责)。**换腾讯云证书时只需把下面两行路径指过去,reload 即可。** |
| | | # * `www`/退域名 → 腾讯云签发的 DV(SAN: dqrcfwpt.com + www.dqrcfwpt.com,人工续期) |
| | | # |
| | | # 那能不能让 8081 同时说明文和 TLS?**不能让 nginx 用两个 server 块分别 listen**: |
| | | # nginx 要求同一个 address:port 的 ssl 标志一致,混用会直接校验失败 |
| | | # (报 `no "ssl_certificate" is defined for the "listen ... ssl" directive`, |
| | | # 而且错误会指向那个**明文**块的行号,很容易看错地方)。所以明文入口拆到 8082。 |
| | | # ⚠️ 80 上的 ACME 例外不能删:Let's Encrypt 用 HTTP-01 校验续期,它要能读到 |
| | | # http://<域名>/.well-known/acme-challenge/<token>。加 301 时必须给这个前缀留出直读路径, |
| | | # 否则**自动续期会静默失败**,到期那天才发现。 |
| | | # |
| | | # 生产上线时怎么切:把 443 那个 server 块里的 `root` 与两个 location 换成 |
| | | # `root <生产的 dist 目录>;` + `include snippets/talent-card-locations.conf;`,80 的 301 不用动。 |
| | | # |
| | | # 证书:华为云 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。 |
| | | |
| | | # 测试环境 · TLS 入口(域名) |
| | | # ── 测试环境 · 新子域(TLS,443 = 正式入口)────────────────────────────── |
| | | server { |
| | | listen 443 ssl; |
| | | http2 on; |
| | | server_name rencaika.dqrcfwpt.com; |
| | | |
| | | ssl_certificate /etc/letsencrypt/live/rencaika.dqrcfwpt.com/fullchain.pem; |
| | | ssl_certificate_key /etc/letsencrypt/live/rencaika.dqrcfwpt.com/privkey.pem; |
| | | ssl_trusted_certificate /etc/letsencrypt/live/rencaika.dqrcfwpt.com/chain.pem; |
| | | |
| | | ssl_protocols TLSv1.2 TLSv1.3; |
| | | ssl_prefer_server_ciphers off; |
| | | ssl_session_cache shared:SSL:10m; |
| | | ssl_session_timeout 1d; |
| | | |
| | | resolver 223.5.5.5 119.29.29.29 valid=300s; |
| | | ssl_stapling on; |
| | | ssl_stapling_verify on; |
| | | |
| | | add_header Strict-Transport-Security "max-age=86400" always; |
| | | |
| | | include snippets/talent-card-locations.conf; |
| | | } |
| | | |
| | | # ── 测试环境 · 新子域的 8081(与 443 同一套内容,小程序白名单填哪个都行)── |
| | | server { |
| | | listen 8081 ssl; |
| | | http2 on; |
| | | server_name rencaika.dqrcfwpt.com; |
| | | |
| | | ssl_certificate /etc/letsencrypt/live/rencaika.dqrcfwpt.com/fullchain.pem; |
| | | ssl_certificate_key /etc/letsencrypt/live/rencaika.dqrcfwpt.com/privkey.pem; |
| | | ssl_trusted_certificate /etc/letsencrypt/live/rencaika.dqrcfwpt.com/chain.pem; |
| | | |
| | | ssl_protocols TLSv1.2 TLSv1.3; |
| | | ssl_prefer_server_ciphers off; |
| | | ssl_session_cache shared:SSL:10m; |
| | | ssl_session_timeout 1d; |
| | | |
| | | resolver 223.5.5.5 119.29.29.29 valid=300s; |
| | | ssl_stapling on; |
| | | ssl_stapling_verify on; |
| | | |
| | | include snippets/talent-card-locations.conf; |
| | | } |
| | | |
| | | # ── 旧名字(www / 退域名)的 8081:那两个名字已不在我们手上,保留只为兼容 ── |
| | | server { |
| | | listen 8081 ssl; |
| | | http2 on; |
| | |
| | | include snippets/talent-card-locations.conf; |
| | | } |
| | | |
| | | # 测试环境 · 明文兜底(IP 访问用;HSTS 管不到 IP,所以这条永远可用) |
| | | # ── 明文兜底(IP 访问用;HSTS 管不到 IP,所以这条永远可用)────────────── |
| | | server { |
| | | listen 8082; |
| | | server_name _; |
| | | include snippets/talent-card-locations.conf; |
| | | } |
| | | |
| | | # ── 80:跳转到 https,但 ACME 校验直读 ──────────────────────────────── |
| | | server { |
| | | listen 80; |
| | | server_name www.dqrcfwpt.com dqrcfwpt.com; |
| | | return 301 https://$host$request_uri; |
| | | server_name rencaika.dqrcfwpt.com; |
| | | |
| | | location ^~ /.well-known/acme-challenge/ { |
| | | root /var/www/html; |
| | | } |
| | | |
| | | location / { |
| | | return 301 https://$host$request_uri; |
| | | } |
| | | } |
| | | |
| | | # ── 生产预留占位页(旧名字;那两个名字已指向甲方机器,这段实际已不生效)──── |
| | | server { |
| | | listen 443 ssl; |
| | | http2 on; |