# 部署文档

1. **生产环境配置**

   - 生产环境默认配置文件： `.env.production`

   ```properties
   NODE_ENV=production
   ```

   - Nginx配置参考

    ```nginx
    http{
        server {
            listen 8080;
            server_name 22.86.116.29;

            # 前端资源部署在根路径
            location / {
                root /path/to/dist/; # 前端资源在Nginx中的位置
                index  index.html index.htm;
                try_files $uri $uri/ /index.html; # 前端history模式回退
            }

            location /v1 {
                proxy_pass http://22.86.116.29:10008;    # API接口地址（转发）
            }

            location /logout {
                proxy_pass http://22.86.116.29:10008;    # 单点登录退出接口单独转发（不在v1下面）
            }
       }
   }
   ```

2. **打包**

   - 方式1：执行 `npm run build` 或者 `make build` ，打包到 `dist/` 目录（手动压缩）；
   - 方式2：执行 `make package`，打包到压缩文件 `dist.zip` 。

3. **部署**

   将压缩文件 `dist.zip` 拷贝到服务器 `nginx-1.x.xx/html/` 目录下解压（ `dist` 目录）。

4. **访问**

   按 `步骤1` 中配置，浏览器访问 `http://22.86.116.29:8080` 即可（注：线上通过单点登录访问）。
