但在有些应用中,需要使静态文件能够响应POST请求。对于Nginx,可以修改nginc.conf配置文件,改变“405错误”为“200 ok”,并配置location来解决,方法如下:
. 代码如下:
server ? ?{ ? ? ? ?listen ?80; ? ? ? ?server_name www.jb51.net; ? ? ? ?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美国高防vps.1:10080; ? ? ? ? ? ?fastcgi_index index.php; ? ? ? ?} ? ?}
22658962