优秀的编程知识分享平台

网站首页 > 技术文章 正文

简单记录基于若依vue3项目在nginx下的部署

nanyue 2025-01-21 20:23:27 技术文章 5 ℃

简单记录下基于若依vue3项目()开发的项目在nginx下的部署,以备不时之需。

我使用工具环境为:vue3、vue router4、nginx1.20.2、Windows 10

  • 修改vite.config.js中base路径
  • 修改路由中配置router/index.js


  • 使用默认打包地址dist进行打包
  • 我的本机路径
  • nginx配置文件nginx.conf
server {
        listen       80;
        server_name localhost 127.0.0.1;

       
		location /wsqgsl {
			alias D:/projects/project_GongShangLian/gsl-web/dist/;
            #index  index.html;
            try_files $uri $uri/ /wsqgsl/index.html;
        }
       
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }

我的是在本机测试,部署linux时,修改为对应目录即可

  • 浏览器访问

OK没问题

最后附上若依Vue3项目地址:GitHub https://github.com/yangzongzhuan/RuoYi-Vue3

最近发表
标签列表