关于我们

质量为本、客户为根、勇于拼搏、务实创新

< 返回新闻公共列表

宝塔新建的数据库安装后网站显示405 Not Allowed nginx

发布时间:2019-10-26 14:25:46

1、首先看下出现405的提示信息


    
  405 Not Allowed  nginx/1.8.1

这是由于nginx安装的时候默认静态文件禁止使用POST方式请求,出现的禁止访问信息


2、有以下三种解决方法

1)静态server下的location加入error_page 405 =200 $uri;

修改nginx下src/http/modules/ngx_http_static_module.c文件


这一段注释掉,重新编译,不要make install编译生成的nginx文件复制到sbin下  重启nginx


3)

upstream static_backend {  
    server localhost:80;  }  
  server {  
    listen 80;  
    # ...  
    error_page 405 =200 @405;  
    location @405 {  
        root /srv/http;  
        proxy_method GET;  
        proxy_pass http://static_backend;  
    }  }



/template/Home/Zkeys/PC/Static