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中,加路径或者路由时报错解决的主要内容,如果未能解决你的问题,请参考以下文章

kibana加访问控制时报错--Kibana did not load properly.Check the server output for more information

安装MongoDB启动时报错‘发生系统错误2’的解决办法

嘿嘿!报错不断呀!快哉快哉,检测nginx配置文件时报错,整它!

tomcat启动后,页面浏览时报错 Unable to compile class for JSP的解决方案

前端页面跳转时路径上传参数有特殊符号时报错,解决

Java操作某方法时报错:java.lang.NoSuchMethodError