vue单页面刷新

只需修改nginx配置文件

server {
  listen 80;
  listen [::]:80;
  server_name wxx.kingsuper.net;
  access_log off;
  index index.html index.htm index.jsp;
  root /data/wwwroot/wxx.kingsuper.net;
  
  #error_page 404 /404.html;
  #error_page 502 /502.html;
  
  location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ {
    expires 30d;
    access_log off;
  }
  location ~ .*\.(js|css)?$ {
    expires 7d;
    access_log off;
  }
  location ~ /(\.user\.ini|\.ht|\.git|\.svn|\.project|LICENSE|README\.md) {
    deny all;
  }
  location ~ {
    try_files $uri $uri/  /index.html;
  }
    
}

  将之前的配置改成下面红色的就ok

  之前的配置:

  location ~ {
    proxy_pass http://127.0.0.1:8080;
    include proxy.conf;
  }

  现在的配置

  location ~ {

index.html;
  }
 
 改完配置之后执行更新nginx命令
  service nginx reload

相关文章:

  • 2021-07-15
  • 2022-01-21
  • 2021-08-23
  • 2021-12-13
  • 2021-12-09
  • 2021-08-31
  • 2021-11-11
猜你喜欢
  • 2021-09-29
  • 2022-02-26
  • 2021-10-06
  • 2021-07-25
  • 2021-08-09
  • 2021-12-17
相关资源
相似解决方案