Apache2 403 Forbidden in custom document root

标签 apache ubuntu webserver http-status-code-403 document-root

我在互联网上搜索了有关此主题的任何内容,但我无法使其正常工作。生无可恋....
我只想在自定义文档根文件夹中访问我的 index.php,但我一直收到此错误
enter image description here
我想要的新文档根目录而不是/var/www/html 默认值被称为

/home/ever/FH/SKS/frontend
我已将此文件夹和所有子文件夹的所有权限递归设置为 775。
enter image description here
主要的 apache 配置文件/etc/apache2/apache2.conf 如下所示:
enter image description here
我发现的大多数关于如何设置新目录根目录的说明都告诉我只需更改/etc/apache2/sites-available/000-default.conf 文件中的路径以指向我的新文档根目录。
我的 000-default.conf:
enter image description here
我还尝试了 000-default.conf 文件的一个版本,如下所示:
enter image description here
符号链接(symbolic link)应该是正确的:
enter image description here
我没有设置任何 .htaccess 文件或更改其他任何内容。
请帮助我......我很绝望。在 XAMPP 中这非常容易,但我拒绝这不能用普通的 Apache 服务器来完成。不可能有那么大的交易吧?

最佳答案

似乎在 apache 网络服务器的 2.4 版中我必须使用

<Directory /var/www/foo>
  Require all granted
</Directory>
而不是 2.2 语法
<Directory /var/www/example.com>
  Order allow,deny
  Allow from all
</Directory>
此外,我必须将配置放在
/etc/apache2/apache2.conf 
文件而不是
/etc/apache2/sites-available/000-default.conf
文件。
我的 apache2.conf 现在看起来像这样:
enter image description here
允许我最终在没有 PHP 支持的情况下访问该文件似乎....
但这是另一场漫长而复杂的战斗,我猜是 XAMPP 从未发生过的......

关于Apache2 403 Forbidden in custom document root,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64911622/

相关文章:

java - Apache HttpClient 4.3.3 如何找到请求站点的目标IP

amazon-web-services - docker 问题 devmapper : Unknown device

postgresql - 如何解决 PostgreSQL pgAdmin error "Server instrumentation not installed"for adminpack?

php - 错误 500 在 Linux Apache 上最后 1 分钟之后

C++ HTTP Web 服务器库

python - 在 Windows 中将 Python Web 服务器作为服务运行

apache - 如何将特定链接重定向到 https ://everything else to http://using . htaccess?

apache - 缺少 Solr solconfig.xml

php - 在服务器上安装linux

python - 仅在我的两个相同网站之一上出现导入错误