【发布时间】:2016-06-21 19:01:29
【问题描述】:
我刚开始在我的 Mac (El Capitan 10.11.13) 上使用 Apache,但我想更改文档根目录。但是,我不确定我是否完全了解如何执行此操作,或者是否可以按照我想要的方式进行设置...
首先,这是我的 httpd.conf 文件中的 sn-p(我没有做任何更改,这是库存)...
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>
我想将 DocumentRoot 更改为我通常保存 Web 开发工作的文件夹,即:
/Users/myname/Desktop/Stuff/Development
我知道第一步是替换 .conf 文件中的 DocumentRoot 和 Directory,但这不起作用 - 我收到 403 禁止错误 - 我不知道之后该怎么做。
我的问题...
是否可以将文档根目录设置为与特定用户(在这种情况下是我)关联的文件夹?我是我机器的唯一用户,如果 Apache 指向那个文件夹,我会更容易做我需要做的事情。
如果是这样,除了更改 .conf 文件的 sn-p 的前两行之外,我还需要做什么?请具体说明,因为我对使用终端比较陌生。
非常感谢。
【问题讨论】:
-
应该采取几个步骤,看看:Configuring Apache Virtual Hosts on Mac OS X愿它帮助你。
-
@triffic 对不起,我从来没有说过谢谢!这确实帮助了我!
标签: macos apache osx-elcapitan