【问题标题】:apache2 vhost going to wrong webrootapache2 vhost 错误的 webroot
【发布时间】:2013-08-24 00:13:28
【问题描述】:

我所有的虚拟主机都被放入第一个可用的 webroot 中,而不是它们分配的 webroot 中,除了我的第二个正在疯狂。

如果我尝试访问 ipv6mailer.com,我会观看热门直播 ->

[error] [client 24.184.110.39] script not found or unable to stat: /home/downlowd/www/login-form.php

确实,该文件“不”存在。它应该在 /home/ipv6mailer/www

我有 3 个虚拟主机,其中两个将访问 /home/downlwd/www 并完全忽略 ServerName。

如果我评论我们的 downlowd.com,尝试访问 ipv6mailer.com 的日志输出看起来像 ->

[Wed Aug 21 15:23:12 2013] [crit] [client 24.184.110.39] (13)Permission denied: /home/wemail1/www/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable

它将使用“新”默认值,而不是 ServerName

# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

#<IfDefine DEFAULT_VHOST>
# see bug #178966 why this is in here

# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 80

# Use name-based virtual hosting.
NameVirtualHost *:80

# When virtual hosts are enabled, the main host defined in the default
# httpd.conf configuration will go away. We redefine it here so that it is
# still available.
#
# If you disable this vhost by removing -D DEFAULT_VHOST from
# /etc/conf.d/apache2, the first defined virtual host elsewhere will be
# the default.


# vim: ts=4 filetype=apache

<VirtualHost *:80>
        ServerName www.downlowd.com
        ServerAlias downlowd.com *.downlowd.com
        ServerPath /downlowd.com
        DocumentRoot /home/downlowd/www
        <Directory "/home/downlowd/www">
                Options Indexes FollowSymLinks MultiViews ExecCGI Includes
                AllowOverride All
                Order allow,deny
                Allow from all
        </Directory>
</VirtualHost>

AddHandler cgi-script .php .php4 .php3


<VirtualHost *:80>
        ServerName www.wemail1.com
        ServerAlias wemail1.com *.wemail1.com
        ServerPath /wemail1.com
        DocumentRoot /home/wemail1/www
        <Directory "/home/wemail1/www">
                Options Indexes FollowSymLinks MultiViews ExecCGI Includes
                AllowOverride All
                Order allow,deny
                Allow from all
        </Directory>
</VirtualHost>

<VirtualHost *:80>
        ServerName www.ipv6mailer.com
        ServerAlias ipv6mailer *.ipv6mailer.com
        ServerPath /ipv6mailer
        DocumentRoot /home/ipv6mailer/www
        <Directory "/home/ipv6mailer/www">
                Options Indexes FollowSymLinks MultiViews ExecCGI Includes
                AllowOverride All
                Order allow,deny
                Allow from all
        </Directory>
</VirtualHost>



dev-box-201 www # /usr/sbin/apache2 -S
apache2: Could not reliably determine the server's fully qualified domain name, using dev-box-201.nyctelecomm.com for ServerName
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:80                   is a NameVirtualHost
         default server www.downlowd.com (/etc/apache2/vhosts.d/00_default_vhost.conf:42)
         port 80 namevhost www.downlowd.com (/etc/apache2/vhosts.d/00_default_vhost.conf:42)
         port 80 namevhost www.wemail1.com (/etc/apache2/vhosts.d/00_default_vhost.conf:58)
         port 80 namevhost www.ipv6mailer.com (/etc/apache2/vhosts.d/00_default_vhost.conf:71)
Syntax OK

【问题讨论】:

  • 权限已经过双重检查。略有不同的错误,但仍然混合匹配。转到 ipv6mailer.com/login-form.php 现在会产生 [Wed Aug 21 15:16:13 2013] [crit] [client 24.184.110.39] (13)Permission denied: /home/wemail1/www/.htaccess pcfg_openfile:无法检查 htaccess 文件,确保它是可读的。还是错误的目录/

标签: apache2 vhosts


【解决方案1】:

如果该目录的有效值为 AllowOverride != none (IOW,如果 Apache 配置为在那里查找 htaccess)。

【讨论】:

    猜你喜欢
    • 2014-12-19
    • 2018-04-29
    • 1970-01-01
    • 2018-01-13
    • 2016-12-06
    • 1970-01-01
    • 2017-10-17
    • 2016-04-23
    • 1970-01-01
    相关资源
    最近更新 更多