# MES 生产管理系统 - 阿里云部署完成

## ✅ 部署状态：已完成

### 🌐 外网访问地址

| 服务 | 地址 | 状态 |
|------|------|------|
| **MES系统** | https://erp.we-smart.cn | ✅ 已配置 |
| **API接口** | https://erp.we-smart.cn/api/ | ✅ 已配置 |

---

## 🔧 阿里云服务器配置

### Nginx 配置

**配置文件**: `/etc/nginx/conf.d/zhibu-all.conf`

**ERP/MES 配置片段**:
```nginx
# MES生产管理系统
server {
    listen 443 ssl http2;
    server_name erp.we-smart.cn;
    ssl_certificate /etc/letsencrypt/live/www.we-smart.cn-0001/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/www.we-smart.cn-0001/privkey.pem;

    # 前端页面 - FRP穿透到工厂服务器7012端口
    location / {
        proxy_pass http://127.0.0.1:7012;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_cache_bypass $http_upgrade;
        proxy_read_timeout 86400;
    }

    # API接口 - FRP穿透到工厂服务器7013端口
    location /api/ {
        proxy_pass http://127.0.0.1:7013/;
        proxy_http_version 1.1;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_read_timeout 300;
    }
}
```

### FRP 端口映射

| 服务 | 工厂本地端口 | 阿里云端口 |
|------|-------------|-----------|
| MES Web | 8091 | 7012 |
| MES API | 3009 | 7013 |

---

## ✅ 验证测试

### 阿里云本地测试
```bash
# Web端口测试
curl -s -o /dev/null -w '%{http_code}' http://127.0.0.1:7012
# 结果: 200 ✅

# API端口测试
curl -s -o /dev/null -w '%{http_code}' http://127.0.0.1:7013/api/health
# 结果: 200 ✅
```

### Nginx 配置测试
```bash
nginx -t
# 结果: syntax is ok, test is successful ✅
```

### Nginx 状态
```bash
systemctl status nginx
# 结果: active (running) ✅
```

---

## 📝 部署时间线

| 时间 | 操作 | 状态 |
|------|------|------|
| 2026-04-13 | MES系统开发完成 | ✅ |
| 2026-04-13 | 工厂本地部署 | ✅ |
| 2026-04-13 | FRP穿透配置 | ✅ |
| 2026-04-13 | 阿里云Nginx配置 | ✅ |

---

## 🔗 访问链接

- **生产管理系统**: https://erp.we-smart.cn
- **研发管理系统**: https://rd.we-smart.cn
- **主网站**: https://www.we-smart.cn

---

*部署完成时间: 2026-04-13*
