Files
2026-05-27 16:53:25 +08:00

96 lines
1.8 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# OfferPie 全局 Nginx 网关
单机部署的全局反向代理服务,统一管理 HTTPS 入口。
## 域名映射
| 域名 | 端口 | 说明 |
|------|------|------|
| www.offerpai.com.cn | 10302 | OfferPie 前端 |
| api.offerpai.com.cn | 10202 | OfferPie Java 后端 API |
| ai.offerpai.com.cn | 10502 | OfferPie Python AI 服务 |
未匹配的域名或 IP 访问返回 444(直接断开连接)。
## 首次部署(Ubuntu 24
### 1. 更新系统并安装 Docker
```bash
apt update && apt upgrade -y
apt install -y docker.io
systemctl enable docker && systemctl start docker
```
### 2. 安装 Docker Compose
```bash
apt install -y docker-compose-v2
```
### 3. 设置 docker-compose 快捷引用
```bash
echo 'alias docker-compose="docker compose"' >> ~/.bashrc
source ~/.bashrc
```
### 4. 配置 Docker 镜像加速器
```bash
mkdir -p /etc/docker
cat > /etc/docker/daemon.json << 'EOF'
{
"registry-mirrors": [
"https://05f073ad3c0010ea0f4bc00b7105ec20.mirror.swr.myhuaweicloud.com",
"https://aknp1c38.mirror.aliyuncs.com"
]
}
EOF
systemctl restart docker
```
### 5. 配置 Git 记住账号密码
```bash
git config --global credential.helper store
```
### 6. 拉取项目
推荐放在 `/app/` 目录下:
```bash
mkdir -p /app && cd /app
git clone http://git.jianshixingqiu.com/offerpai/global-nginx-config.git
cd global-nginx-config
git checkout master
```
### 7. 启动服务
```bash
docker compose up -d --build
```
## 日常操作
### 更新配置
修改 `nginx.conf` 后重新构建:
```bash
docker compose up -d --build
```
### 证书更新
替换 `certificate/` 目录下的证书文件后重新构建。
## 文件说明
- `nginx.conf` - Nginx 主配置
- `dockerfile` - 镜像构建文件
- `docker-compose.yml` - 容器编排配置
- `certificate/` - SSL 证书目录