![我如何才能确定“AH01630:客户端被服务器配置拒绝:/home/christos/wordpress/”?](https://linux22.com/image/754910/%E6%88%91%E5%A6%82%E4%BD%95%E6%89%8D%E8%83%BD%E7%A1%AE%E5%AE%9A%E2%80%9CAH01630%EF%BC%9A%E5%AE%A2%E6%88%B7%E7%AB%AF%E8%A2%AB%E6%9C%8D%E5%8A%A1%E5%99%A8%E9%85%8D%E7%BD%AE%E6%8B%92%E7%BB%9D%EF%BC%9A%2Fhome%2Fchristos%2Fwordpress%2F%E2%80%9D%EF%BC%9F.png)
我在新的 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 80
GET / 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,并正在深入研究它。