gpt4 book ai didi

apache:无权访问/在此服务器上。当我使用虚拟主机时

转载 作者:行者123 更新时间:2023-12-05 08:15:09 24 4
gpt4 key购买 nike

例如virtualHost的文档根目录是/var/www,服务器名是aaa.com。但是,如果我使用 localhostaaa.com 访问服务器,apache 会告诉我 forbidden。如果我将 http.conf 中的 Directory 选项更改为 /var/www,apache 将运行良好。不知道为什么?

我想在每个 httpd-vhosts.conf 中设置 Directory 选项,而不是在 httpd.conf 中,我该怎么做?

这是我的http.conf:

enter image description here

这是我的httpd-vhosts.conf:

enter image description here

最佳答案

http.conf文件你应该只为 <Directory /> 定义选项.您应该在 httpd-vhosts.conf 中定义的所有 VirtualHosts 选项文件。像这样的东西:

httpd.conf:

DocumentRoot "/var/www"

<Directory />
Order deny,allow
Deny from all
Options None
AllowOverride None
</Directory>

httpd-vhosts.conf:

ServerName aaa.com
DocumentRoot /var/www

<Directory /var/www>
Options FollowSymLinks Includes
AllowOverride All
Order allow,deny
Allow from all
</Directory>

关于apache:无权访问/在此服务器上。当我使用虚拟主机时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10445455/

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