但在有些应用中,需要使静态文件能够响应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.1:10080; fastcgi_index index.php; } }
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/226042.html原文链接:https://javaforall.net
