liufumingren
3c252a65d3
feat(deploy): 证书同步脚本支持站点个性化配置外置(customDir 契约)
生成的 server 块不再内联 location /,改为只含证书骨架(listen / server_name /
ssl_certificate*),尾部以 include <customDir>/<domain>/*.conf 收口;站点级
location / root / 伪静态等个性化配置由运维放进该目录,脚本绝不内联、绝不覆盖。
默认目录 <confDir>/custom(生产 /www/wwwroot/nginx_config/custom、开发
D:/wms/nginx_config/custom),位于部署根上一级之外,发布回退不会触碰。
配置入口:新增 `--custom-dir` 参数、`CERT_SYNC_CUSTOM_DIR` 环境变量与配置键 customDir,
缺省即 <confDir>/custom;--help、参数解析默认值与启动日志同步补充。
目录维护(ensureCustomConf,幂等且绝不覆盖用户文件):
- 递归创建 <customDir>/<domain>/(0755),保证 server 块 include 的通配符始终合法
(目录不存在 / 目录为空 / 目录有文件 三种情况 nginx -t 均通过,已在生产 nginx 1.28.0 实测);
- 目录内已有其它 *.conf → 视为用户自定义配置:不写默认文件,并删除脚本自产的
00-default.conf(避免两个 location / 触发 nginx duplicate location);
- 目录内无其它 *.conf → 首次原子写默认文件 00-default.conf(0644,首行带脚本标记),
已存在(无论是否被运维改过)一律不覆盖;
- 只有带脚本标记的文件才可能被删除,无标记文件一律不动;dry-run 只打印计划、不落盘。
其它:
- server 块内容校验放宽为「upstreamInclude 或 customGlobPath 命中即可」(upstream
include 现在位于外置文件内,不再直接出现在 server 块里);
- 旧域名下线仍只删 confDir 根层的 server 块,custom/<domain>/ 目录保留不删
(旧块删除后其 include 已失效,残留目录无副作用,可被运维移作他用)。
2026-09-27 03:13:21 +08:00
..
2026-09-23 02:46:44 +08:00
2026-07-04 23:30:32 +08:00
2026-07-04 23:30:32 +08:00
2026-09-05 22:43:38 +08:00
2026-08-17 22:10:47 +08:00
2026-08-15 20:12:23 +08:00
2026-08-26 15:35:35 +08:00
2026-04-05 09:03:50 +08:00
2026-07-04 23:30:32 +08:00
2026-05-11 08:44:27 +08:00
2026-09-03 17:03:59 +08:00
2026-07-04 23:30:32 +08:00
2026-07-04 23:30:32 +08:00
2026-07-04 23:30:32 +08:00
2026-07-04 23:30:32 +08:00
2026-08-30 07:28:36 +08:00
2026-08-30 07:28:36 +08:00
2026-03-24 23:59:59 +08:00
2026-09-25 23:42:01 +08:00
2026-09-08 04:26:39 +08:00
2026-07-02 22:08:47 +08:00
2026-07-02 22:08:47 +08:00
2026-09-08 04:26:39 +08:00
2026-07-02 22:08:47 +08:00
2026-09-15 15:31:43 +08:00
2026-09-04 21:43:05 +08:00
2026-09-04 21:43:05 +08:00
2026-08-26 15:33:11 +08:00
2026-03-24 23:59:59 +08:00
2026-07-04 23:30:32 +08:00
2026-08-15 18:22:30 +08:00
2026-09-24 03:20:23 +08:00
2026-09-24 03:20:23 +08:00
2026-09-24 03:20:23 +08:00
2026-09-24 03:20:23 +08:00
2026-09-24 03:20:23 +08:00
2026-09-24 03:20:23 +08:00
2026-09-24 03:20:23 +08:00
2026-09-24 03:20:23 +08:00
2026-09-27 03:05:15 +08:00
2026-03-25 13:17:51 +08:00
2026-03-23 17:10:07 +08:00
2026-09-08 04:26:39 +08:00
2026-08-30 07:28:36 +08:00
2026-03-24 23:59:59 +08:00
2026-09-18 22:38:57 +08:00
2026-09-13 02:24:37 +08:00
2026-07-04 23:30:32 +08:00
2026-07-27 03:46:07 +08:00
2026-05-30 17:30:17 +08:00
2026-03-24 23:59:59 +08:00
2026-03-24 23:59:59 +08:00
2026-03-24 23:59:59 +08:00
2026-09-27 03:13:21 +08:00
2026-09-08 04:26:39 +08:00
2026-09-08 04:26:39 +08:00