nginx中,加路径或者路由时报错解决

Posted 入了前端头发就凉凉

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了nginx中,加路径或者路由时报错解决相关的知识,希望对你有一定的参考价值。

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

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

 

 server {
        listen       80;
        server_name  localhost;
        root C:UsersAdministratorDesktopdist;
        autoindex on;
        index  index.html index.htm;
        location /{
            root C:UsersAdministratorDesktopdist;。
            try_files $uri /index.html;
            index index.html index.htm;
         }
    }

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

 

以上是关于nginx中,加路径或者路由时报错解决的主要内容,如果未能解决你的问题,请参考以下文章