docs: 增加 Nginx Proxy Manager (NPM) 配置指南

This commit is contained in:
yczpf2019
2026-01-24 16:27:32 +08:00
parent b7e093dd68
commit 23932b25de

View File

@@ -56,7 +56,9 @@ pm2 startup
``` ```
### 4.2 使用 Nginx 反代 (推荐) ### 4.2 使用 Nginx 反代 (推荐)
如果你想通过域名访问并使用标准端口 (80/443),请参考以下 Nginx 配置:
#### A. 传统 Nginx 配置 (命令行)
如果你使用原生 Nginx请参考以下配置
```nginx ```nginx
server { server {
@@ -80,12 +82,8 @@ server {
proxy_set_header Connection "upgrade"; proxy_set_header Connection "upgrade";
proxy_set_header Host $host; proxy_set_header Host $host;
# 允许上传大文件 (如库同步或大项目)
client_max_body_size 100M; client_max_body_size 100M;
proxy_connect_timeout 3600s;
proxy_read_timeout 3600s; proxy_read_timeout 3600s;
proxy_send_timeout 3600s;
} }
# 处理 Socket.io 特殊路径 # 处理 Socket.io 特殊路径
@@ -99,6 +97,29 @@ server {
} }
``` ```
#### B. Nginx Proxy Manager (NPM) 配置 (可视化)
如果你使用的是 NPM请按以下步骤配置
1. **Details 选项卡**
* **Domain Names**: `你的域名`
* **Scheme**: `https`
* **Forward Hostname/IP**: `127.0.0.1`
* **Forward Port**: `7100`
* **Websockets Support**: **必须勾选 (ON)**
2. **Custom Locations 选项卡**
* 点击 **Add Location**:
* **Define Location**: `/mixly-socket/`
* **Forward Scheme**: `https`
* **Forward Hostname/IP**: `127.0.0.1`
* **Forward Port**: `7100`
* 点击内置的齿轮图标或进入 **Advanced**,确保有以下配置(通常勾选 Websockets Support 后 NPM 会自动处理,但建议检查):
```nginx
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
```
3. **Advanced 选项卡** (可选)
* 建议添加:`client_max_body_size 100M;` 以支持大文件。
## 5. 跨平台特性说明 ## 5. 跨平台特性说明
- **路径自动适配**:本项目已重构 `config.js`,部署时会自动识别 Linux 路径,无需手动修改 `config.json`。 - **路径自动适配**:本项目已重构 `config.js`,部署时会自动识别 Linux 路径,无需手动修改 `config.json`。