1. 程式人生 > >Mac啟動Apache之後訪問localhost提示403 Forbidden

Mac啟動Apache之後訪問localhost提示403 Forbidden

最近學習PHP需要, 需要在Mac上啟動Apache, 啟動後出現訪問localhost之後提示

Forbidden

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

網上百度了很多解決方法, 包括修改User Group, Directory塊與新建{使用者名稱}.conf, 都不管用.

最後試著恢復原先的設定, 並且將DocumentRoot與Directory路徑修改回預設的路徑:

#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but # symbolic links and aliases may be used to point to other locations. # DocumentRoot "/Library/WebServer/Documents/" <Directory "/Library/WebServer/Documents/">

終端: 停止Apache

sudo apachectl stop

終端: 啟動Apache

sudo apachectl start

之後訪問localhost, 成功!
訪問域名

訪問ip