http 405 错误

来源:互联网 发布:万网域名账户间转移 编辑:程序博客网 时间:2024/05/16 14:04

Apache、IIS、Nginx等绝大多数web服务器,都不允许静态文件响应POST请求,否则会返回“HTTP/1.1 405 Method not allowed”错误。


解决办法:

server
{
   listen       80;
   server_name  domain.s135.com;
   index index.html index.htm index.php;
   root  /opt/htdocs;

   if (-d $request_filename)
   {
       rewrite ^/(.*)([^/])$ http://$host/$1$2/ permanent;
   }

   error_page   405 =200 @405;
   location @405
   {
       root  /opt/htdocs;
   }     

   location ~ .*\.php?$
   {
       include conf/fcgi.conf;      
       fastcgi_pass  127.0.0.1:10080;
       fastcgi_index index.php;
   }
}

原创粉丝点击