Mac apache You don't have permission to access / on this server.


在mac下配置完apache和php環境后,通過localhost訪問頁面,出現403Forbidden。頁面提示:

 Forbidden

 You don't have permission to access / on this server.  

解決辦法是修改/etc/apache/httpd.conf的配置  

1、打開終端

2、cd /etc/apache2  --切換到apache目錄

3、sudo vim httpd.conf  --需要輸入電腦密碼

如果apache版本是2.2的話,應該這么寫

<Directory "/Users/apple/Sites/">--/Users/apple/Sites是自己設置的apache指向的站點目錄,默認是/Library/WebServer/Document
  Options Indexes MultiViews   
  AllowOverride All   

  # OSX 10.9 / Apache 2.2   
  Order from deny, allow   
</Directory>

如果apache版本是2.4的話,應該這么寫

<Directory "/Users/apple/Sites/">--/Users/apple/Sites是自己設置的apache指向的站點目錄,默認是/Library/WebServer/Document

  Options Indexes MultiViews

  AllowOverride All   
  # OSX 10.10 / Apache 2.4
  
  Require all granted   
</Directory>
參考博文鏈接:https://www.jianshu.com/p/7dd74c57d56c


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM