Nginx静态文件响应POST请求 提示405错误的解决方法

2019-10-17 21:09:50刘景俊

        fastcgi_pass  127.0.0.1:10080;   
        fastcgi_index index.php;   
    }   
}  

当然也可以修改nginx源代码来解决
修改源代码,重新编译安装nginx
编辑nginx源代码


[root@localhost ~]# vim src/http/modules/ngx_http_static_module.c  

修改: 找到下面一段注释掉


/*  
if (r->method & NGX_HTTP_POST)  
{  
    return NGX_HTTP_NOT_ALLOWED;  
}  
*/  

然后按照原来的编译参数,重新编译安装nginx,即可