gpt4 book ai didi

ubuntu - DocumentRoot 没有改变,从 Apache2 2.2.22 更新到 2.4.7

转载 作者:行者123 更新时间:2023-12-04 18:32:28 24 4
gpt4 key购买 nike

我确实有以下问题。我已经将一些具有相同层次结构和网站结构的网站移到了带有 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>

当然,在加载站点启用/* 的东西之前。

最佳答案

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

Allow from all
必须替换为:
Require all granted
之后,配置被加载。在没有警告之前没有错误。但这就是问题所在,整个 conf 文件都被忽略了。

关于ubuntu - DocumentRoot 没有改变,从 Apache2 2.2.22 更新到 2.4.7,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23521998/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com