Nginx解决post请求405问题

时间:2023-03-10 02:31:12
Nginx解决post请求405问题

和工商银行的一个合作项目,对方客户端需要请求我们的一个静态页面,但是客户端发送过来的请求方法用的post,日志显示405错误(请求方法错误),正常一个静态页面直接用get请求就可以了,工行那边说写死了无法更改,但是项目还需要做只能我们修改了

nginx配置文件如下:

server {
listen 80;
server_name zt.xw.com;
access_log /var/log/nginx/zt.xw.com.log main;
root /var/www/html/zt/;
index index-no.html;
###工行合作用一个月2017.08.07
location /
{
root /var/www/html/zt/;
error_page 405 =200 http://$host$request_uri;
}
#####
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 10d;
}
location ~ .*\.(js|css)?$
{
expires 1h;
}
}

 ps:还有其他办法,比如重新编译nginx等,但是我觉得上面的的方法是最简单,快速的。