server {
    # 监听的端口号
    listen       3988;

    # 服务名称 改成自己服务器的地址
    server_name  127.0.0.1;
    

    # vuejs静态文件配置
    location / {
        # 静态文件的位置
        root   /srv/aiPowerWeb/;  
        
        # hash 模式下,找不到路径就切换到 index.html页面
        try_files $uri $uri/ @router;
        index  index.html index.htm;
    }
    # 对应上面的@router,主要原因是路由的路径资源并不是一个真实的路径,所以无法找到具体的文件
    # 因此需要rewrite到index.html中,然后交给路由在处理请求资源
    location @router {
        rewrite ^.*$ /index.html last;
    }
}

相关文章:

  • 2021-09-04
  • 2018-01-15
  • 2022-01-18
  • 2021-08-03
  • 2021-11-19
  • 2021-07-22
猜你喜欢
  • 2021-12-10
  • 2022-12-23
  • 2021-09-05
  • 2022-12-23
  • 2021-11-19
  • 2021-11-19
  • 2021-11-19
相关资源
相似解决方案