RuoYi(若依)前後端分離版本,windows下部署(nginx)

摘自:https://blog.csdn.net/yueyekkx/article/details/105505490

上一篇用了tomcat部署(https://blog.csdn.net/yueyekkx/article/details/105491363),
還是覺得nginx是王道話不多說開始:
還是windows下部署:
nginx jar包

前端:
1.1前端一樣:

運行代碼:npm run build:prod
生成一個dist文件夾

後端:
打成jar包

maven打包 :按照1,2,3步驟,輸入命令

clean package -Dmaven.test.skip=true

項目目錄下會產生target文件夾,內有ruoyi.jar文件。


開始部署:
nginx下載解壓版,解壓

修改conf下的nginx.conf文件

server {
listen 80;
server_name localhost;
location / {
root F:/RuoYi-Vue/ruoyi-ui/dist/;
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;
}
}

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
其中
listen 80; 端口
server_name localhost; 名稱
root F:/RuoYi-Vue/ruoyi-ui/dist/; 是dist文件夾的路徑;
proxy_pass http://localhost:8080/; 是後端地址

安裝並啓動redis;

然後分別啓動前後端即可:
後端:java -jar 文件拖進黑窗口


前端啓動nginx:
cmd進入nginx目錄,start nginx.exe即可


輸入網址:http://localhost即可登錄
————————————————
版權聲明:本文爲CSDN博主「yueyekkx」的原創文章,遵循CC 4.0 BY-SA版權協議,轉載請附上原文出處鏈接及本聲明。
原文鏈接:https://blog.csdn.net/yueyekkx/article/details/105505490

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章