1. 打開修改/etc/apache2/httpd.conf內容, 查找如下:
-
DocumentRoot "/Library/WebServer/Documents"
-
<Directory "/Library/WebServer/Documents">
-
#
-
# Possible values for the Options directive are "None", "All",
-
# or any combination of:
-
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
-
#
-
# Note that "MultiViews" must be named *explicitly* --- "Options All"
-
# doesn't give it to you.
-
#
-
# The Options directive is both complicated and important. Please see
-
# http://httpd.apache.org/docs/2.4/mod/core.html#options
-
# for more information.
-
#
-
Options FollowSymLinks Multiviews
-
MultiviewsMatch Any
-
-
#
-
# AllowOverride controls what directives may be placed in .htaccess files.
-
# It can be "All", "None", or any combination of the keywords:
-
# AllowOverride FileInfo AuthConfig Limit
-
#
-
AllowOverride None
-
-
#
-
# Controls who can get stuff from this server.
-
#
-
Require all granted
-
</Directory>
原來Apache根目錄是/Library/WebServer/Documents, 現改爲/Users/username/phpSites, 如下:
-
DocumentRoot /Users/username/phpSites
-
<Directory /Users/username/phpSites>
-
Options Indexes MultiViews
-
# apache 2.2
-
# AllowOverride All
-
# Order allow,deny
-
# Allow from 127.0.0.1
-
-
# apache 2.4
-
Require local
-
</Directory>
Apache運行命令:
sudo apachectl start //開始
sudo apachectl restart //重啓
sudo apachectl stop //停止