RuoYi-Vue 部署 Linux环境 若依前后端分离项目(war 包+nginx版本)
文章目錄
- 一、軟件安裝部署
- 1. 安裝jdk
- 2. mysql8安裝部署
- 3. redis安裝
- 4. nginx 安裝部署
- 5. Tomcat10 下載和配置 Linux 環境
- 6. 克隆項目
- 二、后端項目
- 2.1. 修改數據庫連接
- 2.2. 修改Redis連接信息
- 2.3. 文件路徑
- 2.4. 日志存儲路徑調整
- 2.5. 修改war打包
- 2.6. 編譯打包
- 三、前端項目
- 3.1. 安裝依賴
- 3.2. 構建生產環境
- 四、項目部署
- 4.1.創建目錄
- 4.2. 后端文件上傳
- 4.3. 前端文件上傳
- 五、nginx配置啟動
- 5.1. nginx配置
- 5.2. 重新啟動nginx
- 六、服務啟動
- 6.1. redis啟動
- 6.2. 創建ry-vue數據庫
- 6.3. 后端項目啟動
- 6.4. 登錄
- 6.5. 效果圖
一、軟件安裝部署
1. 安裝jdk
https://gblfy.blog.csdn.net/article/details/103435776
2. mysql8安裝部署
https://blog.csdn.net/weixin_40816738/article/details/119544641
3. redis安裝
https://gblfy.blog.csdn.net/article/details/114371657
4. nginx 安裝部署
https://gblfy.blog.csdn.net/article/details/119536779
5. Tomcat10 下載和配置 Linux 環境
https://blog.csdn.net/weixin_40816738/article/details/90391526
- 效果圖
6. 克隆項目
git clone git@gitee.com:y_project/RuoYi-Vue.git二、后端項目
2.1. 修改數據庫連接
# 進入后端項目目錄 cd RuoYi-Vue\ruoyi-admin\src\main\resources\bin2.2. 修改Redis連接信息
2.3. 文件路徑
application.yml中的profile需要改為服務器存在的真實路徑,根據實際情況調整
2.4. 日志存儲路徑調整
logback.xml文件中的路徑建議改為./logs,根據實際情況調整
2.5. 修改war打包
2.6. 編譯打包
# 進入后端項目目錄 cd RuoYi-Vue\bin先清理
再編譯打包
注:執行完成后在RuoYi-Vue\ruoyi\target\文件夾下面會生成一個ruoyi-admin.war文件
三、前端項目
3.1. 安裝依賴
# 進入前端項目 cd RuoYi-Vue\ruoyi-ui# 安裝依賴 npm install --registry=https://registry.npm.taobao.org3.2. 構建生產環境
# 構建生產環境 npm run build:prod注:執行完成后在ruoyi-ui文件夾下面會生成一個dist文件夾
四、項目部署
4.1.創建目錄
cd /app mkdir ruoyi ruoyi-ui -p4.2. 后端文件上傳
后端編譯的RuoYi-Vue\ruoyi-admin\target\ruoyi-admin.war文件上傳至tomcat10的根目錄下,ruoyi-admin.war包重命名為ROOT,移動到webapps下
4.3. 前端文件上傳
前端編譯的RuoYi-Vue\ruoyi-ui\dist下面的文件上傳至/app/ruoyi-ui目錄下面
五、nginx配置啟動
5.1. nginx配置
替換ruoyi-ui的實際存儲路徑即可
cd /usr/local/nginx/conf vim nginx.conf將文件內容清空并添加以下內容:
worker_processes 1;events {worker_connections 1024; }http {include mime.types;default_type application/octet-stream;sendfile on;keepalive_timeout 65;server {listen 80;server_name localhost;location / {#root /home/ruoyi/projects/ruoyi-ui;root /app/ruoyi-ui;try_files $uri $uri/ /index.html;index index.html index.htm;}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://localhost:8080/;}error_page 500 502 503 504 /50x.html;location = /50x.html {root html;}} }5.2. 重新啟動nginx
cd /usr/local/nginx/sbin六、服務啟動
6.1. redis啟動
[root@node2 redis-6.2.5]# cd /usr/local/redis/bin [root@node2 bin]# ./redis-server6.2. 創建ry-vue數據庫
初始化數據庫腳本
6.3. 后端項目啟動
[root@node2 app]# cd /app/ruoyi [root@node2 ruoyi]# java -jar ruoyi-admin.jar6.4. 登錄
6.5. 效果圖
總結
以上是生活随笔為你收集整理的RuoYi-Vue 部署 Linux环境 若依前后端分离项目(war 包+nginx版本)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Hadoop集群安装部署_分布式集群安装
- 下一篇: linux 其他常用命令