事实证明,我试图查看文件夹的内容但什么也没有出来,我得到了这幅图像。
这是我的配置文件,它给出了一个错误
<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
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
<Directory /var/www/html>
DirectoryIndex red.html
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
<Directory /var/www/html/datos>
DirectoryIndex index.html
Options FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
Alias /wiki /home/alumno/wiki
<Directory /home/alumno/wiki>
DirectoryIndex index.html
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
# 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
ErrorDocument 404 /no_encontrada.html
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
导致我出错的是以下部分,因为它之前有效
Alias /wiki /home/alumno/wiki
<Directory /home/alumno/wiki>
DirectoryIndex index.html
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
我已经重新启动了该服务,并且它重新启动正常,如下图所示
它应该像下面的图片一样
/home/student/wiki 文件夹的权限是:
我刚刚查看了错误日志,它显示以下内容
[Sun Jan 30 20:43:23.441530 2022] [authz_core:error] [pid 6242:tid 139632557659904] [client 127.0.0.1:57776] AH01630: client denied by server configuration: /home/alumno/wiki
非常感谢您的帮助
答案1
问题是你需要在里面给出这让我失望的东西。
Require all granted
我保留如下内容:
Alias /wiki /home/alumno/wiki
<Directory /home/alumno/wiki>
DirectoryIndex index.html
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
Require all granted
</Directory>
这是因为它在 apache 2.2 版本中可以正常工作,但对于 2.4 版本,您必须添加最后一行