【发布时间】:2014-08-06 11:56:29
【问题描述】:
希望从每台机器的单个 apache/网站转移到每台机器的多个虚拟主机设置中获得一些指导。
当前设置:带有从源代码安装的软件包的 LAMP 堆栈: Apache 2.4.2、php 5.4.3 和 mysql 5.1.63 对于当前的单个站点 (site1.ie) 设置,我在 httpd.conf 中有指向当前站点的 site1 documentroot 的虚拟主机详细信息、DocumentRoot 和 Directory 指令。
为了启用虚拟主机,我取消了 Include conf/extra/httpd-vhosts.conf 的注释,并将虚拟主机站点配置详细信息移至 httpd-vhosts.conf。像这样的:
<VirtualHost _default_:443>
ServerName http://site1.ie
DocumentRoot "/usr/local/apache2/htdocs/site1"
ServerAlias site1.ie
</VirtualHost>
当我取消注释 httpd.conf 文件中的 DocumentRoot 详细信息并重新启动 httpd 时,我在尝试加载 site1.ie 时收到 403 禁止错误。
httpd-vhosts.conf 中的目录指令(从 httpd.conf 移出):
<Directory "/usr/local/apache2/htdocs/site1">
Options Indexes FollowSymLinks
AllowOverride AuthConfig
Require all granted
</Directory>
编辑:
httpd 中的 error_log 给出了这个错误:AH01630: client denied by server configuration: /usr/local/apache2/htdocs/
这是网站数据的位置,是否受此目录指令控制:
<Directory />
AllowOverride none
Require all denied
</Directory>
据我所知,这是默认拒绝访问此文件夹但允许通过其自己的目录指令访问其子文件夹的默认设置?
发生 403 问题的地方是我在主 httpd.conf 文件中注释掉 DocumentRoot 并在 virtualhost 指令中定义 DocumentRoot(在 httpd.conf 文件或 httpd-vhosts.conf 文件中) .
我暂时将目录/指令(如上所示)更改为要求所有已授予,这消除了 403 错误,但我所使用的只是默认的 apache 'It works' 页面。我仍然无法访问为 site1 定义的 documentroot 目录。
有人能指点我做错了什么吗?
【问题讨论】:
-
检查日志以查看实际请求的文件。这将帮助您确定 Root 是否错误或 perms 是否错误。
-
httpd 中的 error_log 给出了这个错误:AH01630: client denied by server configuration: /usr/local/apache2/htdocs/
标签: apache ubuntu permissions virtualhost document-root