今天把网站部署到服务器上,结果登录的时候 Nginx 报错:“405 Not Allowed”。如下图:

解决方法:
修改 Nginx 的配置文件:nginx.conf
添加以下内容:
server {
listen 80;
root localhost;
index index.html index.htm;
location / {
try_files $uri $uri/ /index.html;
}
# To allow POST on static pages 允许静态页使用POST方法
error_page 405 =200 $uri;
}
这样就可以正常登录了。
原创文章,作者:kepupublish,如若转载,请注明出处:https://blog.ytso.com/tech/pnotes/231377.html