温馨提示
您也可参考PIGX官方部署文档 点击前往
一、项目下载
- 运行含有APP管理功能的PC控制台
bash
# 下载源代码
git clone https://git.pig4cloud.com/jsonflow/pigx-cloud-jsonflow-ui.git
cd pigx-cloud-jsonflow-ui
npm install
npm run dev
- 运行 app 代码
bash
# 下载源代码
git clone https://git.pig4cloud.com/jsonflow/pigx-cloud-jsonflow-app.git
bash
cd pigx-cloud-jsonflow-app
npm install
npm run dev:h5
二、NGINX 部署发布
- 构建生产资源
bash
npm run build:h5
- 设置 pigx-ui 前端生产地址
bash
├── assets
├── index.html
└── static
三、配置NGINX
bash
server {
listen 28080;
server_name localhost;
# 将上述步骤构建的产物放在 /path/mobile/index.html,注意在 path 下新建 mobile路径
root /path/;
location ^~/api/ {
proxy_pass http://pigx-gateway:9999/; #注意/后缀
proxy_connect_timeout 60s;
proxy_read_timeout 120s;
proxy_send_timeout 120s;
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 http;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host;
}
location / {
try_files $uri $uri/ /mobile/index.html;
}
}