linux部署vue项目--nginx

一、上传文件包

  1. 将压缩包dist.zip上传至linux系统下---如/home/server/dist

  2. 解压压缩包

cd /home/server/dist
##解压
unzip dist.zip
12320369-2e6e52006d6c009b.png
image.png

二、配置nginx配置文件

  1. 与发包人员确定后缀名---------如host

  2. cd /xxx/nginx/conf

  3. 编辑nginx.conf vi nginx.conf

  4. niginx配置增加

 location /host{
   alias /home/server/vue/dist/;
   index index.html;
   try_files $uri $uri/ /index.html last;
}

location /(后缀名){
  alias 压缩包解压路径;
  index index.html;
  try_files $uri $uri/ /index.html last;
}
12320369-7753c6bd9d4bdda2.png
image.png
  1. 到nginx的sbin目录下重启nginx
./nginx  –s reload

三、访问网址


12320369-fdbcd384696c579d.png
image.png

猜你喜欢

转载自blog.csdn.net/weixin_34293902/article/details/90942224