mac osx下apache下的坑: you don’t have permission to access / on this server
阿新 • • 發佈:2018-01-28
pos require tor director div http localhost mce pan
在Mac下Apache修改默認站點的目錄時,遇到403錯誤,
you don’t have permission to access / on this server
首先按照google到教程:
修改Apache目錄
上面說到了mac下Apache的默認文件夾為/Library/WebServer/Documents
,該目錄默認是隱藏的,操作不是很方便,我們可以將其修改成自定義的目錄。
- 打開終端,輸入命令:
sudo vi /etc/apache2/httpd.conf
- 找到如下兩處
DocumentRoot "/Library/WebServer/Documents"
<Directory "/Library/WebServer/Documents">
- 將兩處中引號中的目錄替換為自定義的目錄
完成以上三步後,重啟Apache,將之前創建的index.php文件拷貝到自定義目錄中,然後在瀏覽器中輸入localhost
,如果出現PHP的info頁,則表示?目錄修改成功。
解決方法:在Directory指令裏,增加一條 Require all granted,如下示:
<Directory "/Users/jnovack/Sites/"> Options Indexes MultiViews AllowOverride All # OSX 10.10 / Apache 2.4 Require all granted </Directory>
註意:
AllowOverride All
默認情況下 AllowOverride是none
不修改這句的話會一直給你報403錯誤哦
mac osx下apache下的坑: you don’t have permission to access / on this server