Nginx登錄報錯:405 Not Allowed的解決方法

  • 2019 年 11 月 13 日
  • 筆記

今天把網站部署到服務器上,結果登錄的時候 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://www.w3h5.com/post/419.html