【问题标题】:Apache - changing document root (Mac)Apache - 更改文档根目录 (Mac)
【发布时间】: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 的前两行之外,我还需要做什么?请具体说明,因为我对使用终端比较陌生。

非常感谢。

【问题讨论】:

标签: macos apache osx-elcapitan


【解决方案1】:

是的,您不能在不授予新路径权限的情况下更改 DocumentRoot。如果您必须使用它,则必须将 chmod +x 添加到每个路径,在您的情况下是

用户 我的名字 ... 发展

这样做并不安全。我会使用一个不涉及用户的文件夹。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-04-17
    • 1970-01-01
    • 1970-01-01
    • 2012-04-26
    • 1970-01-01
    • 1970-01-01
    • 2017-06-25
    • 2015-01-28
    相关资源
    最近更新 更多