Apache:透過 .htaccess 進行存取管理不起作用

Apache:透過 .htaccess 進行存取管理不起作用

幾個小時以來,我一直在嘗試建立一個工作.htaccess文件,禁止存取除少數文件和資料夾之外的所有文件。

但是每當我在.htaccess根資料夾的直接子目錄中的文件中寫入“Allow from all”時/srv/www/htdocs/,它只會顯示“伺服器錯誤!”結束。在附件中,我向您發送了我目前的httpd.conf「default-server.conf」。

我的系統:

OS: openSUSE Tumbleweed x86_64 
Host: 20XXS00100 ThinkPad X1 Carbon Gen 9 
Kernel: 5.13.13-1-default 
Uptime: 12 hours, 14 mins 
Packages: 5771 (rpm), 8 (snap) 
Shell: bash 5.1.8 
Resolution: 1920x1200 
DE: Plasma 5.22.4 
WM: KWin 
Theme: Breeze Dark [Plasma], Breeze [GTK2/3] 
Icons: [Plasma], breeze-dark [GTK2/3] 
Terminal: konsole 
CPU: 11th Gen Intel i7-1165G7 (8) @ 4.700GHz 
GPU: Intel TigerLake-LP GT2 [Iris Xe Graphics] 
Memory: 5945MiB / 31820MiB

如果您能幫我解決這個問題,我將非常感激!

預設伺服器.conf:https://www.opensuse-forum.de/wcf/attachment/15371-default-server-conf-txt/

httpd.conf:https://www.opensuse-forum.de/wcf/attachment/15372-httpd-conf-txt/

答案1

我必須使用“Require”指令,然後它才能工作。

感謝@MrWhite

相關內容