405 method not allowed
Apache、IIS、Nginx等绝大多数web服务器,都不允许静态文件响应POST请求,否则会返回“HTTP/1.1 405 Method not allowed”错误。
[root@localhost ~]# curl -d 1=1 http://192.168.2.156/index.txt <html> <head><title>405 Not Allowed</title></head> <body bgcolor="white"> <center><h1>405 Not Allowed</h1></center> <hr><center>nginx/1.2.3</center> </body> </html>
网上找了很多方法,都不行,也尝试了张老师的方法()也失败了,不知道为什么。但张老师的方法提醒了我
error_page 405 =200 @405;
location @405
{
root /opt/htdocs;
}
改变405错误,返回200,用location解决。405 method not allowed
error_page 405 =200 @405;
location @405 {
proxy_method GET;
proxy_pass http://$host;
}
我这边也是改变405错误,返回200,并改为get请求,重新访问,在访问日志上会有两条访问记录。
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-42620-1.html
然后趁机在南海岛礁上加强军事化