簡體   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