Apache Indexes 選項適用於 HTTP,但不適用於 HTTPS

Apache Indexes 選項適用於 HTTP,但不適用於 HTTPS

我正在使用 Rocky Linux 8.4 和 Apache 2.4 的普通安裝進行測試。我配置了一個虛擬主機並正在運行,我還透過 Certbot 配置了 Lets Encrypt 證書,這也很好用。

我想允許特定資料夾上的目錄列表,因此啟用了選項索引,這透過 HTTP 按預期工作,但透過 HTTPS 我收到 403 Forbidden。 Certbot 腳本插入了重寫規則,但我不認為這是問題所在,我嘗試停用該規則,以便我可以透過HTTP 進行測試,這沒有什麼區別,但將其包含在此處,以防它實際上相關。

我的虛擬主機配置如下所示:

<VirtualHost *:80>
    ServerName test.prot0type.com
    ServerAlias test.prot0type.com
    DocumentRoot /var/www/test.prot0type.com

    <Directory /var/www/test.prot0type.com/test>
        Options +Indexes
    </Directory>

    RewriteEngine on
    RewriteCond %{SERVER_NAME} =test.prot0type.com
    RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

<VirtualHost *:443>
    ServerName test.prot0type.com
    ServerAlias test.prot0type.com
    DocumentRoot /var/www/test.prot0type.com

    <Directory /var/www/test.prot0type.com/test>
        Options +Indexes
    </Directory>

</VirtualHost>

訪問http://test.prot0type.com/test/按預期工作。

訪問https://test.prot0type.com/test/結果為 403 並在錯誤日誌中得到:

無法提供目錄 /var/www/test.prot0type.com/test/:找不到符合的 DirectoryIndex (index.html),選項指令禁止伺服器產生的目錄索引

我如何找到哪個選項指令正在執行此操作?我已經搜索了所有conf文件但找不到它。

相關內容