代码拉取完成,页面将自动刷新
https://nodejs.org/dist/v12.18.2/node-v12.18.2-x64.msi
# 更换npm镜像
npm config set registry http://registry.npm.taobao.org
# 安装webpack
npm install webpack -g
# 安装vue-cli
npm install vue-cli -g
# 克隆项目到本地
git clone https://gitee.com/InternGroup/monitor-fe.git
# 进入项目目录
cd monitor-fe
# 安装依赖
npm install
在此下载相应平台的模拟程序并启动
npm run dev
# 生产环境下打包
npm run build:prod
项目目录下生成dist
文件夹
$ ls
favicon.png index.html static/
$ ls static/
css/ fonts/ img/ js/
下载最新版本并安装,之后进入nginx根目录
# nginx目录结构
$ ls
conf/ contrib/ docs/ html/ logs/ nginx.exe* temp/
清空nginx的html
文件夹内所有内容,将上一步生成的dist
目录下所有内容拷贝到nginx的html
文件夹内。下一步修改nginx服务器配置:
修改nginx目录下conf
文件夹内nginx.conf
的server字段内容如下
server {
# nginx服务器默认端口为80,可直接在浏览器输入localhost访问
listen 80;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
# 后端服务的配置
# 将所有 /api 的请求转发至后台服务器
location /api/ {
proxy_redirect off;
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_pass http://localhost:8080/;
}
}
然后将nginx安装路径添加至环境变量。
# 启动nginx
$ start nginx
# 查看nginx进程
$ tasklist /fi "imagename eq nginx.exe"
映像名称 PID 会话名 会话# 内存使用
========================= ======== ================ =========== ============
nginx.exe 12088 Console 1 12,248 K
nginx.exe 2452 Console 1 12,608 K
启动好以后再将后台服务启动(上面提到的模拟程序或最终发布的jar包),浏览器输入localhost
并回车,完成项目部署。
# 重启
$ nginx -s reload
# 关闭
$ nginx -s quit
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。