diff --git a/.env.development b/.env.development index be4979db7..9fbbe276a 100644 --- a/.env.development +++ b/.env.development @@ -17,3 +17,7 @@ VUE_CLI_BABEL_TRANSPILE_MODULES = true # External auth VUE_APP_LOGIN_PATH = '/core/auth/login/' VUE_APP_LOGOUT_PATH = '/core/auth/logout/' + + +# Dev server for core proxy +VUE_APP_CORE_HOST = 'http://localhost:8080' diff --git a/README.md b/README.md index f17986235..685f8395d 100644 --- a/README.md +++ b/README.md @@ -1,25 +1,51 @@ -# +# Lina + +Lina 是 JumpServer 的前端 UI 项目, 主要使用 [Vue](https://cn.vuejs.org/), [Element UI](https://element.eleme.cn/) 完成, +名字来源于 Dota 英雄 [Lina](https://baike.baidu.com/item/%E8%8E%89%E5%A8%9C/16693979) + +## 开发运行 + +前置条件: 部署运行好 JumpServer API 服务器 -## Project setup ``` -yarn install +1. 安装依赖 +$ yarn install + +2. 修改 .env.development VUE_APP_CORE_HOST +# ... +VUE_APP_CORE_HOST = 'JUMPSERVER_APIHOST' + +3. 运行 +$ yarn serve + +4. 构建 +$ yarn build ``` -### Compiles and hot-reloads for development +## 生产中部署 +下载 RELEASE 文件,放到合适的目录,修改 nginx配置文件如下 ``` -yarn serve +server { + listen 80; + + location /ui/ { + try_files $uri / /ui/index.html; + alias /opt/lina/; + } + + location / { + rewrite ^/(.*)$ /ui/$1 last; + } +} ``` -### Compiles and minifies for production -``` -yarn build -``` +## License & Copyright +Copyright (c) 2014-2020 飞致云 FIT2CLOUD, All rights reserved. -### Lints and fixes files -``` -yarn lint -``` +Licensed under The GNU General Public License version 2 (GPLv2) (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at + +https://www.gnu.org/licenses/gpl-2.0.html + +Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -### Customize configuration -See [Configuration Reference](https://cli.vuejs.org/config/). diff --git a/nginx.conf b/nginx.conf index f05865b8d..239ce871e 100644 --- a/nginx.conf +++ b/nginx.conf @@ -1,7 +1,7 @@ server { listen 80; - location ^~ /ui/ { + location /ui/ { try_files $uri / /ui/index.html; alias /opt/lina/; } diff --git a/vue.config.js b/vue.config.js index 676def842..ac7ec8ac0 100644 --- a/vue.config.js +++ b/vue.config.js @@ -41,14 +41,14 @@ module.exports = { // change xxx-api/login => mock/login // detail: https://cli.vuejs.org/config/#devserver-proxy [process.env.VUE_APP_BASE_API]: { - target: `http://localhost:8080`, + target: process.env.VUE_APP_CORE_HOST, changeOrigin: true, pathRewrite: { ['^' + process.env.VUE_APP_BASE_API]: '' } }, '^/core/': { - target: `http://localhost:8080`, + target: process.env.VUE_APP_CORE_HOST, changeOrigin: true } },