Nginx的405 not allowed错误解决
来源:互联网 发布:无锡网络教育高起专 编辑:程序博客网 时间:2024/05/24 06:46
1.首先看到的页面是nginx返回的页面,得知错误要从nginx上来解决
返回页面:
<html><head><title>405 Not Allowed</title></head><body bgcolor="white"><center><h1>405 Not Allowed</h1></center><hr><center>nginx/1.0.11</center></body></html>
2.上网查资料,原来因为这里请求的静态文件采用的是post方法,nginx是不允许post访问静态资源。题话外,试着post访问了下www.baidu.com发现页面也是报错
3.现贴出三种解决方式
1.将405错误指向成功(我采用的这种方法解决的问题)
静态server下的location加入error_page 405 =200 $uri;
location ~ ^/better/.*\.(htm|html|gif|jpg|jpeg|png|ico|rar|css|js|zip|txt|flv|swf|doc|ppt|xls|pdf|json|ico|htc)$ {<span style="white-space:pre"></span>root D:/code/BetterjrWeb;<span style="white-space:pre"></span>error_page 405 =200 $uri;}
2.修改nginx下src/http/modules/ngx_http_static_module.c文件
if (r->method & NGX_HTTP_POST) { return NGX_HTTP_NOT_ALLOWED;}这一段注释掉,重新编译,不要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; }}
1 0
- Nginx的405 not allowed错误解决
- nginx 405 not allowed问题的解决
- nginx 405 not allowed问题的解决
- operation not allowed after resultset closed错误的解决
- Tomcat 405 Not Allowed nginx
- nginx中HTTP/1.1 405 Method not allowed 的解决方法
- 解决IIS7 HTTP/405 Method Not Allowed 问题的方法.
- 解决IIS7 HTTP/405 Method Not Allowed 问题的方法.
- 关于Operation not allowed after ResultSet closed错误的一种解决方式
- ubuntu 使用btrfs文件系统,出现“sparse file not allowed”错误的解决
- HTTP 405 错误--Method not allowed
- HTTP错误405-Method Not Allowed
- Content is not allowed in prolog错误解决
- Nginx静态资源POST请求返回405 Not Allowed的解决办法
- Nginx HTTP Post Method: 405 Method not allowed 解决办法
- Operation not allowed after ResultSet closed 错误的解决方案
- Sqlite3错误:Recursive use of cursors not allowed 的解决方案
- 解决" DDL statement is not allowed."的问题
- mysql复习小结三远程登录授权
- 【VS开发】【编程开发】【C/C++开发】结构体中的数组与指针的内存分配情况说明
- Cannot make a static reference to the non-static method
- C++学习日记
- Android Studio IDE 导入系统framework.jar包方案
- Nginx的405 not allowed错误解决
- CentOS升级Python2.6到Python2.7并安装pip
- Memory Barriers Are Like Source Control Operations
- mongo 安装
- C语言扫雷
- windows下Graphviz安装及入门教程
- 仿支付宝九宫格显示
- Exception in thread "main" org.openqa.selenium.remote.SessionNotFoundException
- Java操作SQLite实现增删改查