【问题标题】:Apache 403 Forbidden access deniedApache 403 禁止访问被拒绝
【发布时间】:2020-05-08 01:42:42
【问题描述】:

操作系统 Debian 10 (Raspian)
80 端口上的 Apache 2.4.38
8080端口上的Lighttpd/1.4.53

尽管几年来我一直在修补 Linux,但在我最好的日子里,我是一名中级用户。我怀疑这是一个非常基本的配置问题。我错过了什么?

问题
Apache 不允许加载文件。它返回 403/Forbidden 错误。这是我迄今为止所做的。

背景故事
Apache是​​前段时间安装的。我在设置 WordPress 时对其进行了修改,但后来放弃了它,因为它更容易从云堆栈中工作。两年前,我安装了 pihole。它在端口 80 上运行,但几天前我将其切换为 8080,因此我可以安装需要 Apache 和端口 80 的 ownCloud。我过去设置了很多服务器(pihole、WordPress、Plex、Webmin、相关依赖项等) . ownCloud 看起来很简单而且完全可行,所以我去了。但是,完成安装后,我收到 403 Forbidden 错误。请注意,我没有尝试加载默认的“我还活着!”开始之前的页面,所以我不知道它是否可以访问。我想可能不会。

我已经采取的步骤

  1. 确认 apache.conf 中的 documentroot /var/www/html(下)
  2. 确认状态(systemctl status apache)和语法(apache2ctl -t)
  3. 检查了 000-default.conf 中的指令(如下)
  4. 启用调试并查看日志文件是否有错误(如下)
  5. 检查 /var/www 和 /var/www/html 的权限以确保 www-data 权限。
  6. 删除了自己的云。
  7. 卸载并重新安装 Apache。
  8. 多次重启。

../error.log

[access_compat:error] [pid 9477:tid 2993677344] AH01797: client denied by server configuration: /var/www/html/index.php, referer: http://192.168.1.10/
[access_compat:error] [pid 9477:tid 2983195680] AH01797: client denied by server configuration: /var/www/html/favicon.ico, referer: http://192.168.1.10/index.php

/etc/apache/sites-avaialable/000-default.conf(删除 cmets)

<VirtualHost *:80>

        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        <Directory /var/www/html>
            Options Indexes FollowSymLinks
            AllowOverride All
            Order allow,deny
            Require all granted
        </Directory>

</VirtualHost>

/etc/apache/apache.conf(再次为简洁起见,去掉了 cmets)

DefaultRuntimeDir ${APACHE_RUN_DIR}

PidFile ${APACHE_PID_FILE}

Timeout 300

KeepAlive On

MaxKeepAliveRequests 100

KeepAliveTimeout 5

User ${APACHE_RUN_USER} Group ${APACHE_RUN_GROUP}

HostnameLookups Off

ErrorLog ${APACHE_LOG_DIR}/error.log

LogLevel debug

IncludeOptional mods-enabled/*.load IncludeOptional mods-enabled/*.conf

Include ports.conf

<Directory />
        Options FollowSymLinks
        AllowOverride None
        Require all denied </Directory>

<Directory /usr/share>
        AllowOverride None
        Require all granted </Directory>

<Directory /var/www/html>
        Options Indexes FollowSymLinks
        AllowOverride All
        Order allow,deny
        Require all granted </Directory>

AccessFileName .htaccess

<FilesMatch "^\.ht">
        Require all denied </FilesMatch>

LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined LogFormat "%h %l %u %t \"%r\" %>s %O" common LogFormat "%{Referer}i -> %U" referer LogFormat "%{User-agent}i" agent

IncludeOptional conf-enabled/*.conf

IncludeOptional sites-enabled/*.conf

ServerName localhost

【问题讨论】:

    标签: apache configuration installation raspberry-pi4


    【解决方案1】:

    我解决了这个问题。不确定问题是什么,但这是非常基本的问题,无论是在配置文件中还是在所有权/权限中。我通过在单独的机器上安装另一个 apache 实例然后复制配置和索引文件来解决它。我不知道根本原因是什么,但是......现在已经完成了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-06-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-11-25
      • 1970-01-01
      相关资源
      最近更新 更多