apache2 403 在父目录上被禁止
apache2 403 forbidden on parent directory
当我尝试访问父目录时,说 localhost/parent,它给了我 403 forbidden。但是,如果我访问子目录,比如 localhost/parent/index.html,它就会通过。
我相信这是一个配置问题,但有人可以在这里指导我吗?
我尝试按照许多人的建议更改 apache2.conf,但它不起作用。(如下所示)
<Directory "your directory here">
Order allow,deny
Allow from all
Require all granted
</Directory>
错误日志如下:
[Mon Jul 03 11:32:51.028149 2017] [autoindex:error] [pid 4899] [client 127.0.0.1:42462] AH01276: Cannot serve directory /var/www/html/hub/: No matching DirectoryIndex (index.php,index.cgi,index.pl,index.php,index.xhtml,index.htm) found, and server-generated directory index forbidden by Options directive
原来是配置文件的问题,
sudo nano /etc/apache2/mods-enabled/dir.conf
将index.php作为第一个选项,它解决了问题
当我尝试访问父目录时,说 localhost/parent,它给了我 403 forbidden。但是,如果我访问子目录,比如 localhost/parent/index.html,它就会通过。 我相信这是一个配置问题,但有人可以在这里指导我吗? 我尝试按照许多人的建议更改 apache2.conf,但它不起作用。(如下所示)
<Directory "your directory here">
Order allow,deny
Allow from all
Require all granted
</Directory>
错误日志如下:
[Mon Jul 03 11:32:51.028149 2017] [autoindex:error] [pid 4899] [client 127.0.0.1:42462] AH01276: Cannot serve directory /var/www/html/hub/: No matching DirectoryIndex (index.php,index.cgi,index.pl,index.php,index.xhtml,index.htm) found, and server-generated directory index forbidden by Options directive
原来是配置文件的问题,
sudo nano /etc/apache2/mods-enabled/dir.conf
将index.php作为第一个选项,它解决了问题