我如何才能确定“AH01630:客户端被服务器配置拒绝:/home/christos/wordpress/”?

我如何才能确定“AH01630:客户端被服务器配置拒绝:/home/christos/wordpress/”?

我在新的 Debian 10 VM 上运行 Apache 2.4.38,但只收到 403 错误,例如AH01630: client denied by server configuration: /home/christos/wordpress/

目前我有一个/etc/apache2/sites-enabled条目:

<VirtualHost *:80>
    # The ServerName directive sets the request scheme, hostname and port that
    # the server uses to identify itself. This is used when creating
    # redirection URLs. In the context of virtual hosts, the ServerName
    # specifies what hostname must appear in the request's Host: header to
    # match this virtual host. For the default virtual host (this file) this
    # value is not decisive as it is used as a last resort host regardless.
    # However, you must set it for any further virtual host explicitly.
    #ServerName www.example.com

<Directory /home/christos/wordpress>
    Options ExecCGI Indexes FollowSymLinks Multiviews
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

    ServerAdmin webmaster@localhost
    DocumentRoot /home/christos/wordpress

    # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
    # error, crit, alert, emerg.
    # It is also possible to configure the loglevel for particular
    # modules, e.g.
    #LogLevel info ssl:warn

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

    # For most configuration files from conf-available/, which are
    # enabled or disabled at a global level, it is possible to
    # include a line for only one particular virtual host. For example the
    # following line enables the CGI configuration for this host only
    # after it has been globally disabled with "a2disconf".
    #Include conf-available/serve-cgi-bin.conf
</VirtualHost>

我还暂时重命名了该.htaccess文件,但没有明显的区别。

如果我尝试加载http://new.example.com/http://new.example.com/index.html(后者是尝试暂时避开明显的与 DirectoryIndex 相关的问题),它会出现 403 错误,并显示一条日志(例如):

[Tue Jul 14 17:35:37.376815 2020] [authz_core:error] [pid 3162:tid 140122797659904] [client ::1:54384] AH01630: client denied by server configuration: /home/christos/wordpress/

用户可以查看并www-data阅读。/home/christos/wordpress/index.html/home/christos/wordpress/index.php

我是不是漏掉了什么?据我所知,我至少允许加载http://new.example.com/index.html,但只出现了 403 个错误。这包括从浏览器加载,也http://new.example.com包括从浏览器访问 时只获取错误页面的来源。telnet localhost 80GET / HTTP/1.0

谢谢,

- 更新 -

我可能遗漏了有关 2.4 语法的一些信息。编辑后的当前sites-enabled条目仍然出现先前的权限错误,如下所示:

<VirtualHost *:80>
    # The ServerName directive sets the request scheme, hostname and port that
    # the server uses to identify itself. This is used when creating
    # redirection URLs. In the context of virtual hosts, the ServerName
    # specifies what hostname must appear in the request's Host: header to
    # match this virtual host. For the default virtual host (this file) this
    # value is not decisive as it is used as a last resort host regardless.
    # However, you must set it for any further virtual host explicitly.
    #ServerName www.example.com

ServerName new.example.com

<Directory /home/christos/wordpress>
    Options ExecCGI Indexes FollowSymLinks Multiviews
    AllowOverride All
    Require all granted
</Directory>

    ServerAdmin webmaster@localhost
    DocumentRoot /home/christos/wordpress

    # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
    # error, crit, alert, emerg.
    # It is also possible to configure the loglevel for particular
    # modules, e.g.
    #LogLevel info ssl:warn

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

    # For most configuration files from conf-available/, which are
    # enabled or disabled at a global level, it is possible to
    # include a line for only one particular virtual host. For example the
    # following line enables the CGI configuration for this host only
    # after it has been globally disabled with "a2disconf".
    #Include conf-available/serve-cgi-bin.conf
</VirtualHost>

--进一步更新--

我在 DNS 和新开发服务器方面遇到了一些问题。

我登录了我的 DNS 并添加了一条 A 记录以new捕获new.example.com.,但是,显然有一个预先存在的记录匹配new.example.com,并且除了之前的记录外,还添加了我的 A 记录new.example.com

这意味着我尝试更新new.example.com有时会转到开发服务器,有时会转到生产服务器,因此当我尝试在新服务器上运行东西时,我并没有登录到我期望的服务器。

我目前无法让 PHP 执行而不是显示为源;我添加了:

AddHandler php7-script .php

/etc/apache2/sites-enabled条目并到/etc/apache2/apache2.conf,但尚未显示。

php将从命令行运行,我已经libapache2-mod-php安装libapache2-mod-php7.3了,但我没有故意让服务器将页面.php作为 PHP 可执行文件来处理。(我进行了其他搜索,发现例如https://stackoverflow.com/questions/5121495/php-code-is-not-being-executed-instead-code-shows-on-the-page,并正在深入研究它。

相关内容