如果您需要百度文库付费文档,我们可以帮您下载,请联系在线客服qq1257749646。
文中一部分文字:
这一行
DocumentRoot "/Library/WebServer/Documents"
就指定了 Apache HTTP Server 的默认网站资源存放目录。当你没有对 Apache 进行任何自定义配置时,访问本机网站,它即返回
DocumentRoot 下的,名为 index.html 的文件。然后找到如下内容,
<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.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
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
</Directory>
这是是用于对 DocumentRoot 指向的实际文件夹进行权限控制等操作。这里我们将 AllowOverride 后的 NONE 改为 ALL。由于我们在本机
中可以运行多个网站,所以我们要创建不同文件夹用于分别放置各个网站的资源。我们这里要创建一个名为 local.osxmasters.com 的网站,
则我们要在 /Library/WebServer/Documents 向创建一个名为 local.osxmasters.com 的文件夹,执行此命令
sudo mkdir /Library/WebServer/Documents/local.osxmasters.com
创建完毕后。回到 httpd.config 文件,然后找到这一行
#Include /private/etc/apache2/extra/httpd-vhosts.conf
将其行首的 # 删除 (# 的意思为 注释。所有在行首的 # 表示此行为注释内容。应用程序或进程不会对此行中的配置进行读取)。现在,这一行
变为
Include /private/etc/apache2/extra/httpd-vhosts.conf