还要修改一下权限,要不然访问的时候,会出 ”503“ 错误,提示权限没有
在该文件下面,找到这个 <Directory /></Directory> ,然后改成下面这种情况
<Directory />
Options FollowSymLinks
AllowOverride All
Order deny,allow
Allow from all
Satisfy all
</Directory>
这里也一样 ,改成下面这种情况
<Directory "/Users/你的用户名">
#
# 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.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks MultiViews
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
#AllowOverride None
AllowOverride all
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
</Directory>
保存后,重新启动,apache ,在地址栏输入我的项目地址 http://localhost/04/main.php,回车成功了
因为我们在配置里,已经加上了用户名那段路径,所以在地址栏,就不用加,它默认会去你在配置里填的路径下,去找 04这个文件夹里的main.php 文件