devops: 备案通过回切 https 域名 + 流水线 Ali 单轨
- nginx-jiu-ali.conf:443 ssl+http2 正式入口(HSTS/XFO/nosniff 安全头、 ACME webroot 续期通道、80→443 跳转);8443 明文过渡口拆除 - 客户端构建 URL 全量回切 https://jiu.51yanmei.com(compile×5/local_test/ release-client/notify) - 流水线去 EC2:deploy-client/site 单轨 Ali、manual 回滚与每日备份切 ali、 seed/reset/debug-db 改容器内取密码(SEC-003,退役 DB_PASSWORD secret) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JJ1g8XV1YhhmHRzhwWEW7o
This commit is contained in:
+46
-19
@@ -2,34 +2,51 @@
|
||||
# 与 nginx-jiu.conf(EC2 pangolin 容器版,listen 127.0.0.1:8445)等价。
|
||||
# CI deploy-server.sh 的 ali 分支落到 /etc/nginx/conf.d/jiu.conf。
|
||||
#
|
||||
# 过渡期入口 = 8443 明文 HTTP,裸 IP 直连 http://182.92.213.171:8443
|
||||
#(备案未通过前 80/443/8080 被阿里云拦截,走非标端口;不建过渡子域,
|
||||
# 证书签给域名对不上 IP,故过渡期不做 TLS——登录口令/JWT 明文传输,仅限过渡;
|
||||
# 备案通过后改回 listen 443 ssl + 域名 + 80→443 跳转块)。
|
||||
# 2026-07-03 备案通过回切:443 ssl(jiu.51yanmei.com)为唯一正式入口 + 80→443 跳转。
|
||||
# 8443 明文过渡口已拆(用户拍板:裸 IP 版 client 从未发过,存量客户端都是 https
|
||||
# 域名 BASE_URL,DNS 回切后自动恢复,8443 无人使用)。
|
||||
# 证书:/etc/nginx/ssl/jiu.51yanmei.com/(2026-07-03 从 EC2 letsencrypt 同步,
|
||||
# 2026-08-28 到期;续期方案=DNS 已指 ali 后 certbot HTTP-01 webroot,见 baize)。
|
||||
# 后端上游 = 127.0.0.1:8081(非 8080!ali 上 8080 已被 pay 项目 payd 占用;
|
||||
# 对应 /opt/jiu/config/production.env 的 SERVER_PORT=8081)。
|
||||
limit_req_zone $binary_remote_addr zone=jiu_pub:10m rate=10r/s;
|
||||
limit_req_status 429;
|
||||
|
||||
server {
|
||||
listen 8443 default_server;
|
||||
server_name _;
|
||||
# ali nginx 1.24 无 `http2 on;`(1.25.1+),用 listen 参数旧语法
|
||||
listen 443 ssl http2 default_server; # 正式入口(备案后回切 2026-07-03)
|
||||
server_name jiu.51yanmei.com _;
|
||||
|
||||
# 备案通过切回 443 时恢复(证书路径仍有效,jiu.51yanmei.com,2026-09-21 到期):
|
||||
# listen 443 ssl http2;
|
||||
# server_name jiu.51yanmei.com;
|
||||
# ssl_certificate /etc/letsencrypt/live/jiu.51yanmei.com/fullchain.pem;
|
||||
# ssl_certificate_key /etc/letsencrypt/live/jiu.51yanmei.com/privkey.pem;
|
||||
# ssl_protocols TLSv1.2 TLSv1.3;
|
||||
# ssl_ciphers HIGH:!aNULL:!MD5;
|
||||
# 证书现为 EC2 同步副本(2026-08-28 到期)。ACME 通道已就绪:待批准后在 ali 跑
|
||||
# `certbot certonly --webroot -w /var/www/acme -d jiu.51yanmei.com` 签新证,
|
||||
# 然后把这两行换成 /etc/letsencrypt/live/jiu.51yanmei.com/ 并配 reload 部署钩子。
|
||||
ssl_certificate /etc/nginx/ssl/jiu.51yanmei.com/fullchain.pem;
|
||||
ssl_certificate_key /etc/nginx/ssl/jiu.51yanmei.com/privkey.pem;
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
ssl_ciphers HIGH:!aNULL:!MD5;
|
||||
ssl_prefer_server_ciphers on;
|
||||
|
||||
# 安全响应头(SEC-P02)。注意 nginx add_header 继承规则:location 内有自己的
|
||||
# add_header 时会整体覆盖 server 级——故 /images、/app/index.html、/downloads
|
||||
# 三处各自补了 HSTS。
|
||||
add_header Strict-Transport-Security "max-age=31536000" always;
|
||||
add_header X-Frame-Options SAMEORIGIN always;
|
||||
add_header X-Content-Type-Options nosniff always;
|
||||
|
||||
client_max_body_size 20m;
|
||||
|
||||
# certbot HTTP-01 续期通道(webroot 独立目录,不放 marketing——
|
||||
# deploy-site 的 rsync --delete 会清掉站点目录里的挑战文件)
|
||||
location ^~ /.well-known/acme-challenge/ {
|
||||
root /var/www/acme;
|
||||
}
|
||||
|
||||
# 商品图片静态文件
|
||||
location ^~ /images/ {
|
||||
alias /opt/jiu/images/;
|
||||
expires 30d;
|
||||
add_header Cache-Control "public, immutable";
|
||||
add_header Strict-Transport-Security "max-age=31536000" always;
|
||||
}
|
||||
|
||||
# 文件导入接口(超时更长)
|
||||
@@ -68,6 +85,7 @@ server {
|
||||
alias /opt/jiu/web/index.html;
|
||||
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
||||
add_header Pragma "no-cache";
|
||||
add_header Strict-Transport-Security "max-age=31536000" always;
|
||||
expires 0;
|
||||
}
|
||||
|
||||
@@ -95,6 +113,7 @@ server {
|
||||
alias /opt/jiu/downloads/;
|
||||
add_header Content-Disposition "attachment";
|
||||
add_header Cache-Control "no-cache";
|
||||
add_header Strict-Transport-Security "max-age=31536000" always;
|
||||
autoindex off;
|
||||
}
|
||||
|
||||
@@ -105,9 +124,17 @@ server {
|
||||
}
|
||||
}
|
||||
|
||||
# 备案通过、入口切回 443 后再恢复此跳转块(80 未备案期间被拦截,挂了也无意义):
|
||||
# server {
|
||||
# listen 80;
|
||||
# server_name jiu.51yanmei.com;
|
||||
# return 301 https://$host$request_uri;
|
||||
# }
|
||||
# 80 → 443 跳转(仅 jiu 域名;51yanmei.com 门户 80 在 51yanmei.conf 自管)。
|
||||
# ACME 挑战必须在跳转前放行(HTTP-01 走 80)。
|
||||
server {
|
||||
listen 80;
|
||||
server_name jiu.51yanmei.com;
|
||||
|
||||
location ^~ /.well-known/acme-challenge/ {
|
||||
root /var/www/acme;
|
||||
}
|
||||
|
||||
location / {
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user