打包Vue项目并部署到Nginx

mac2026-03-27  4

打包Vue项目

方式一:通过在IDE开发工具的终端中,输入命令

npm run build

生成dist压缩文件包

方式二:通过Vue-UI进行项目打包

前提:Vue-Cli版本为3.0+

# 在终端输入命令 vue ui

build完成后就能够在项目里面看到dist文件夹

部署生成的dist文件夹到Nginx

编写nginx/conf/nginx.conf配置文件

server { listen 80; # server_name的值改为你的服务器域名 server_name www.baidu.com; location / { # dist压缩包在服务器的位置 root /usr/local/projects/dist; index index.html; } }
最新回复(0)