apache 403錯誤 Forbidden解決方法

apache 403錯誤 Forbidden解決方法_RedHat/Centos_操作系統

打開網頁,結果訪問提示:403錯誤!關閉了IE的”顯示友好的HTTP錯誤”,顯示沒有權限訪問(You don’t have permission to access / on this server)!

apache 403錯誤 Forbidden解決方法_RedHat/Centos_操作系統

Apache,版本2.4.17,安裝完成後,進行相關測試;

配置了下php的php.in文件,再次localhost打開發現錯誤:

HTTP 錯誤 403 – 禁止訪問,即403 Forbidden:You don’t have permission to access / on this server.

可能是權限不足引起的問題。

解決方法:

打開apache的配置文件httpd.conf,逐行檢查。

找到:

<directory>
AllowOverride none
Require all denied

apache 403錯誤 Forbidden解決方法_RedHat/Centos_操作系統

由於配置了php後,此處“Deny from all”為拒絕一切連接。

把此行修改為 “Allow from all”,即可解決問題。

修改後的代碼為:

<directory> 

Options FollowSymLinks
AllowOverride None
Order deny,allow
allow from all

apache 403錯誤 Forbidden

瀏覽器裡打開http://localhost,顯示it works!問題解決。

總結:

在apache服務器中,遇到403禁止訪問時,重點關注下apache的httpd.conf配置文件中,是否有“Deny from all”這樣的代碼。

這個可能是修改了某些配置文件後,重啟apache,被自動更改的。


分享到:


相關文章: