当我们正常配完nginx时,此时如果在域名的后面加入路径或路由去解析时可能会报一个404的错误,

这个问题其实就是因为我们没有给nginx配路由而已,或者给路由加一个try_files即可,这样就能自动搜索对应的路由了

 

 server {
        listen       80;
        server_name  localhost;
        root C:\Users\Administrator\Desktop\dist;
        autoindex on;
        index  index.html index.htm;
        location /{
            root C:\Users\Administrator\Desktop\dist;。
            try_files $uri /index.html;
            index index.html index.htm;
         }
    }

这是除了没有配代理的完整配置

 

相关文章:

  • 2021-06-15
  • 2022-12-23
  • 2022-12-23
  • 1970-01-01
  • 2022-01-01
  • 2022-12-23
  • 2021-09-17
  • 2022-01-02
猜你喜欢
  • 2021-07-28
  • 2022-12-23
  • 2021-05-28
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-13
相关资源
相似解决方案