今天把网站部署到服务器上,结果登录的时候 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;
}
这样就可以正常登录了。
声明:本文由w3h5原创,转载请注明出处:《Nginx登录报错:405 Not Allowed的解决方法》 https://cloud.tencent.com/developer/article/1537828