oneinstack 部署vue项目

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 ~ {

    try_files $uri $uri/  /index.html;
  }
 
 改完配置之后执行更新nginx命令
  service nginx reload
原文地址:https://www.cnblogs.com/SeaWxx/p/11324468.html