Nginx静态文件响应POST请求,提示405 not allowed 错误问题解决方案方法
修改nginx中
D:\Tools\nginx-1.19.6\conf\nginx.conf
#源文件为如下
#error_page 500 502 503 504 /50x.html;
#location = /50x.html {
# root html;
#}
#修改为为如下
error_page 405 =200 $uri;
server {
listen 9999;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root dist;
index index.html index.htm;
try_files $uri $uri/ /index.html;
#proxy_pass http://page;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
#源文件为如下
#error_page 500 502 503 504 /50x.html;
#location = /50x.html {
# root html;
#}
#修改为为如下
error_page 405 =200 $uri;
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}