Windows部署: 后端端口统一改为8080

This commit is contained in:
2026-09-11 16:34:30 +08:00
parent 064dbb7561
commit fc51641700
4 changed files with 8 additions and 8 deletions
+1 -1
View File
@@ -56,7 +56,7 @@ function Install-NssmService {
New-Item -ItemType Directory -Force -Path (Join-Path $RepoRoot "logs") | Out-Null
New-Item -ItemType Directory -Force -Path (Join-Path $RepoRoot "frontend\logs") | Out-Null
# --- 后端:wagtailcms-backend(waitress WSGI,监听 127.0.0.1:8000) -------------
# --- 后端:wagtailcms-backend(waitress WSGI,监听 127.0.0.1:8080) -------------
Install-NssmService `
-Name "wagtailcms-backend" `
-Application $Powershell `
+3 -3
View File
@@ -1,6 +1,6 @@
# wagtailcms Windows Server 生产环境 Nginx 反向代理配置模板
# (Windows 版 nginx 不支持 Unix Domain Socket 反向代理到 gunicorn,
# 后端改用监听 127.0.0.1:8000 的 waitress,因此这里全部走 TCP 端口。)
# 后端改用监听 127.0.0.1:8080 的 waitress,因此这里全部走 TCP 端口。)
#
# 使用方法:
# 1. 下载 nginx for Windows(http://nginx.org/en/download.html),解压到 C:\nginx
@@ -10,7 +10,7 @@
# 3. 将下面的 example.com / cms.example.com 替换为真实域名
# 4. nginx.exe -t 测试配置,nginx.exe -s reload 重载
#
# 架构:浏览器 -> Nginx(TLS 终止) -> {Next.js:3000(页面渲染) | waitress:8000(/admin /api /static /media 等后端路径)}
# 架构:浏览器 -> Nginx(TLS 终止) -> {Next.js:3000(页面渲染) | waitress:8080(/admin /api /static /media 等后端路径)}
# ---------------------------------------------------------------------------
# 后端管理域名(Wagtail 管理后台 / API),对应 WAGTAILADMIN_BASE_URL
@@ -34,7 +34,7 @@ server {
}
location / {
proxy_pass http://127.0.0.1:8000;
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+1 -1
View File
@@ -18,4 +18,4 @@ if (-not (Test-Path $python)) {
throw "找不到虚拟环境解释器:$python,请先创建虚拟环境并安装 requirements/production-windows.txt"
}
& $python -m waitress --listen=127.0.0.1:8000 --threads=8 wagtailcms.wsgi:application
& $python -m waitress --listen=127.0.0.1:8080 --threads=8 wagtailcms.wsgi:application
+3 -3
View File
@@ -6,7 +6,7 @@
- [`deploy/windows/install-nssm-services.ps1`](../deploy/windows/install-nssm-services.ps1):用 NSSM 把前后端注册为 Windows 服务
- [`requirements/production-windows.txt`](../requirements/production-windows.txt):Windows 专用生产依赖(用 waitress 替代不支持 Windows 的 gunicorn)
架构:浏览器 → Nginx for Windows(TLS 终止)→ { Next.js(127.0.0.1:3000) | waitress(127.0.0.1:8000) },
架构:浏览器 → Nginx for Windows(TLS 终止)→ { Next.js(127.0.0.1:3000) | waitress(127.0.0.1:8080) },
两个进程均由 NSSM 注册为 Windows 服务,实现开机自启 + 崩溃自动重启。
## 1. 服务器基础环境
@@ -124,7 +124,7 @@ Get-Service wagtailcms-*
服务日志分别写在 `C:\wagtailcms\logs\` 和 `C:\wagtailcms\frontend\logs\`(自动按 10MB 滚动)。
> `serve-backend.ps1` 内部用 `waitress-serve` 监听 `127.0.0.1:8000`,`wagtailcms-frontend`
> `serve-backend.ps1` 内部用 `waitress-serve` 监听 `127.0.0.1:8080`,`wagtailcms-frontend`
> 服务直接执行 `npm run start`(Next.js 默认监听 3000)。两者都设置了
> `Start=SERVICE_AUTO_START`(开机自启)+ `AppRestartDelay=5000`(崩溃 5 秒后自动重启)。
@@ -176,7 +176,7 @@ Windows 上常用方案:
New-NetFirewallRule -DisplayName "HTTP" -Direction Inbound -LocalPort 80 -Protocol TCP -Action Allow
New-NetFirewallRule -DisplayName "HTTPS" -Direction Inbound -LocalPort 443 -Protocol TCP -Action Allow
```
云服务商控制台安全组同样放行 80/443;`8000`/`3000` 只监听 `127.0.0.1`,无需(也不应该)对公网开放。
云服务商控制台安全组同样放行 80/443;`8080`/`3000` 只监听 `127.0.0.1`,无需(也不应该)对公网开放。
## 12. 验证清单