Forbidden 403:可以访问本地主机但无法访问其中的文件夹

Forbidden 403: Able to access localhost but unable to access folders within

我可以访问 localhost 和其中的一个文件夹 (http://localhost/ariaconfig/),但无法进一步访问。

我正在尝试访问 /Library/WebServer/Documents/ariaconfig/rest 我已授予读写访问权限,还共享了文件夹(使用mac)。

在我的 httpd.conf 中: 已更改这些行但没有用。

DocumentRoot "/Library/WebServer/Documents"
<Directory "/Library/WebServer/Documents">
    Options Indexes FollowSymLinks Includes ExecCGI
    MultiviewsMatch Any
    Order deny,allow
    AllowOverride All
    Require all granted
</Directory>

在我的httpd-vhosts.conf中添加了:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot /Library/WebServer/Documents
    ServerName localhost
    ErrorLog "/private/var/log/apache2/localhost-error_log"   
    CustomLog "/private/var/log/apache2/localhost-access_log" common
</VirtualHost>

在 error_log 中出现错误:

Cannot serve directory /Library/Webserver/Documents/ariaconfig/rest/: No matching DirectoryIndex (index.html,index.html,index.php,index.html,index.php) found, and server-generated directory index forbidden by Options directive

谢谢。

我认为您的 httpd-vhosts.conf 中存在拼写错误

DocumentRoot /Library/WebServer/Documents

这应该是 Webserver 而不是 WebServer 根据您的规则,S 应该很小

如果不是这种情况,请检查 index.html 或 index.php 是否保留在您的文档根目录中,如果不是,请使用一些虚拟 html 文件创建它。这将是任何网络浏览器的起点。

Check out this wiki article on webserver directory index

在 httpd.conf 中添加了选项 + 索引。