打包到nginx

1. 将dist打一个.zip包

2. 切换到跟目录上传文件并解压

3. 移动到指定文件夹中如web-vue

  whereis nginx  ----查询nginx所在文件目录

  pwd  ----当前路径

  vim nginx.config  ----编辑文件

4.修改nginx配置文件  

location / { 
     root /web-vue ; #/代表根 
     try_file $uri $uri/ /index.html;   # 找当前的url,否则找当前url的/,否则就找index.html
 } 

5. SPA项目需要配置rewrite ,或者try_file

6. 重启服务

      nginx -s reload

  nginx -s stop

  start nginx

猜你喜欢

转载自www.cnblogs.com/ihuangqing/p/11141136.html