Apache httpd.conf 我在默认权限上面修改了下路径,其他都没改动:
<Directory /> AllowOverride none Require all denied </Directory> DocumentRoot "/Users/xxx/Desktop/Project/PhpStorm" <Directory "/Users/xxx/Desktop/Project/PhpStorm"> # # 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>
于是报错: You don't have permission to access / on this server. Windows 上没有出现这个问题。 因为这个是 Mac 用户权限问题。 我把路径的每一个文件夹打开看下了下用户权限,最大发现没有权限访问 Desktop 文件,于是修改为 只读 即可:
建议逐个文件看下用户权限是否打开,我也是一个一个文件找的。
另外: 配置虚拟主机时,对于根目录给与的权限不对也会报这个错。