您的位置 首页 linux 运维

ruoyi-ui

# 克隆项目
git clone https://gitee.com/y_project/RuoYi-Vue

# 进入项目目录
cd ruoyi-ui

# 安装依赖
npm install

# 建议不要直接使用 cnpm 安装依赖,会有各种诡异的 bug。可以通过如下操作解决 npm 下载速度慢的问题
npm install --registry=https://registry.npmmirror.com

# 启动服务
npm run dev

 

浏览器访问 http://localhost:80

发布

# 构建测试环境
npm run build:stage

# 构建生产环境
npm run build:prod

 

需要注意nginx 配置:

 

如果用npm run build:prod 打包,那么:

nginx.conf

server {
    listen       80;
    server_name  localhost;

    #access_log  /var/log/nginx/host.access.log  main;

    location / {
        root   /usr/share/nginx/html;
#         index  index.html index.htm;
        try_files $uri $uri/ /index.html; # 将所有路由请求重定向到index.html
    }


        # 只写了 生产 环境
        location /prod-api/{
            proxy_set_header Host $http_host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header REMOTE-HOST $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_pass  http://platform-test-node.xiaochengxu-test:8080/;
#             proxy_pass  http://123.57.143.145:31067/;

}


}

 

打包的时候检查 是否有 .evn.production 文件

欢迎来撩 : 汇总all

白眉大叔

关于白眉大叔linux云计算: 白眉大叔

热门文章