Nginx 405 not allowed最简单快速解决办法
Apache、IIS、Nginx等绝大多数web服务器,都不允许静态文件响应POST请求,否则会返回“HTTP/1.1 405 Method not allowed”错误。
server {
listen 80;
server_name 域名;
location /{
root /www/文件目录;
index index.html index.htm index.php;
error_page 405 =200 http://$host$request_uri;
}
}
本文介绍了一个常见的Nginx配置问题——当静态文件接收到POST请求时返回405 Method Not Allowed错误的解决方案。通过调整Nginx配置文件中的location指令,可以轻松避免这一问题,确保网站正常运行。
2638

被折叠的 条评论
为什么被折叠?



