参考若依文档:
前端手册 | RuoYi

第一步:1、修改vue.config.js
中的publicPath
属性
原先的属性:
publicPath: process.env.NODE_ENV === "production" ? "/" : "/",

第二步:修改router/index.js
,添加一行base
属性
原先的样式设计:
export default new Router({
mode: 'history', // 去掉url中的#
scrollBehavior: () => ({ y: 0 }),
routes: constantRoutes
})

现在添加的样式设计

这句话加了的意思是让原先的访问路径变成admin

第三步:修改layout/components/Navbar.vue
中的location.href
原先是location.href="/index"

第四步修改:
修改utils/request.js
中的location.href
原先是/index现在改成
location.href = '/admin/index';

之后修改nginx
配置,就能够实现域名访问了
location /admin {
alias /home/ruoyi/projects/ruoyi-ui;
try_files $uri $uri/ /admin/index.html;
index index.html index.htm;
}