繁体   English   中英

访问某些index.php或index.html时出现Apache 403错误,尽管每个都有相似的权限

[英]Apache 403 error from accessing certain index.php or index.html despite having similar permissions for each

我的apache服务器曾经工作过,但它随机地开始为几乎每个目录吐出403错误。 两个目录仍然有效,如何才能使/ srv / www / htdocs中的所有目录正常工作?

我查看了两个工作目录的权限,并将它们与未访问的其他文件/文件夹进行了比较。 两个工作目录是“BIBETIS”和“nextcloud”,而其他一切都不起作用。

BIBETIS下的index.php文件由用户root和组www拥有,其权限是-rwxrwxr-x (我相信755?)。 此目录加载正常并按预期运行。

nextcloud下的index.phpindex.html文件由用户wwwrun和组www拥有。 它的权限再次是-rwxrwxr-x 这一切都按预期运作。

所以,基于此我尝试做sudo chown -R wwwrun:www /srv/www/htdocssudo chown -R wwwrun:www /srv/www/htdocs/*chmod -R 755 /srv/www/htdocs/和类似的变化。 这没有修复apache中的403错误。

我决定退后一步,专注于一个更简单的目录:“map”。 此文件夹有一个index.html文件。 我再次尝试如上所述更改权限,但似乎没有任何帮助。

apache的错误日志读取:

[Fri May 10 01:39:35.665344 2019] [autoindex:error] [pid 2943] [client -:50203] AH01276: Cannot serve directory /srv/www/htdocs/map/: No matching DirectoryIndex (index.php4,index.php5,index.php) found, and server-generated directory index forbidden by Options directive
[Fri May 10 01:39:36.744342 2019] [autoindex:error] [pid 2943] [client -:50203] AH01276: Cannot serve directory /srv/www/htdocs/map/: No matching DirectoryIndex (index.php4,index.php5,index.php) found, and server-generated directory index forbidden by Options directive
[Fri May 10 01:39:42.323373 2019] [autoindex:error] [pid 2944] [client -:50204] AH01276: Cannot serve directory /srv/www/htdocs/map/: No matching DirectoryIndex (index.php4,index.php5,index.php) found, and server-generated directory index forbidden by Options directive
[Fri May 10 01:42:10.018496 2019] [autoindex:error] [pid 2038] [client -:50879] AH01276: Cannot serve directory /srv/www/htdocs/: No matching DirectoryIndex (index.php4,index.php5,index.php) found, and server-generated directory index forbidden by Options directive 

这让我相信它只搜索index.php文件? 所以我在map目录下设置了一个index.php,应用了正确的权限,并且工作正常。 如果是这样,为什么即使在设置了正确的user:group和755权限之后它也无法访问位于htdocs目录中的主index.php

你能告诉我们你的vhost和apache.conf / httpd.conf的配置吗? 为了能够读取index.html,您需要添加到指令DirectoryIndex index.html,否则您的Web服务器将不知道他需要读取它,它应该看起来像这样:

DirectoryIndex index.html index.php4 index.php5 index.php

由于错误消息显示清楚,它与文件/文件夹权限无关!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM