Vue项目执行打包命令,如npm run build
,
打包完成会在项目根目录下生成一个dist的目录,将该目录重命名后上传到服务器
vim /.../conf/nginx.conf
server { listen 80; server_name localhost; location / { root /home/projectXXX; # 项目dist目录 try_files $uri $uri/ /index.html; # 解决刷新报404的问题 index index.html index.htm; }
./nginx -s reload