DocumentRoot未更改,从Apache2 2.2.22更新到2.4.7

时间:2014-05-07 15:27:10

标签: ubuntu directory apache2 virtualhost document-root

我确实有以下问题。我已经将一些具有相同层次结构和网站结构的网站移动到使用Apache 2.4.7的新服务器上。旧的有2.2.22。 我已将默认的DocumentRoot更改为/ var / www

为了测试我在那里创建了一个带有点作为内容的index.html文件。现在我在/ sites-enabled /中有一个文件,包含以下内容:

<VirtualHost *:80>
    ServerAdmin webmaster@test-w2.de
    DocumentRoot /var/www/w2/shop2/website/magento
    ServerName test-w2.de
    ErrorLog /var/www/_logs/w2-error.log

<Directory /var/www/w2/shop2/website/magento>
    php_admin_flag safe_mode Off
    php_admin_value memory_limit 512M
    php_admin_value max_execution_time 600
    php_admin_value upload_max_filesize 128M
    php_admin_value open_basedir /var/www/w2/shop2/website/magento:/usr/:/tmp
    Options -Indexes +FollowSymLinks +Includes
    AllowOverride All
    Order deny,allow
    Allow from all
</Directory>

</VirtualHost>

这是我旧的2.2.22 Apache上的工作配置。现在,当我尝试进入域时,它会抛出带有点的html文件!如果我尝试test-w2.de/w2/shop2/website/magento它会转到正确的目录,但显然效果不是很好;)

因此它完全忽略了DocumentRoot。这有什么不对? error.log什么都没说,access.log显然说它服务于/ var / www的index.html。并且没有像重新启动apache时那样的配置错误。

我还删除了sites-enabled / 000-default.conf。内容将移至apache2.conf,其中包含:

...
<Directory /var/www/>
        Options -Indexes +FollowSymLinks +MultiViews
        AllowOverride None
        Require all granted
</Directory>

当然,在加载已启用网站的/ *内容之前。

1 个答案:

答案 0 :(得分:1)

好的,我解决了。有两件事;首先是事实,原来的apache2.conf正在搜索* .conf文件而我的名字没有任何扩展名。但是,在那个错误之后,虚拟主机仍然被忽略了。我发现了,

Order deny,allow

Allow from all

必须替换为:

Require all granted

之后,配置已加载。在没有警告之前没有错误。但这就是问题所在,整个conf文件被忽略了。