簡體   English   中英

OpenBSD 的 httpd 守護進程 {block} 指令不起作用

[英]OpenBSD's httpd daemon {block} directives not working

我正在嘗試限制對托管在 OpenBSD 的 httpd 本機服務器上的簡單網站的某些子文件夾的訪問。 配置相當簡單,它是為了測試目的:

server "10.0.1.222" {
        listen on 10.0.1.222 port 80
        log style combined
        location "/*php*"{
                root "/FOLDER"
                fastcgi socket "/run/php-fpm.sock"
        }

        directory {
                index "index.php"
        }

        location "/*" {
                root "/FOLDER"
        }

        location "/SUBFOLDER/*" {block}
}

SUBFOLDER ,我放置了一些不打算直接查看的 html。 對於最后一個location指令,我希望像http://10.0.1.222/SUBFOLDER/01.html這樣的請求會被403代碼阻止,但我無法實現。

雖然http://10.0.1.222/SUBFOLDER/返回access denied ,但在SUBFOLDER中請求任何正確的 html 文檔名稱可以滿足該請求,而無需任何投訴。

If string: /SUBFOLDER/* is (as I suppose) proper shell glob that should match string /SUBFOLDER/ itself + any string given after, then requests like http://10.0.1.222/SUBFOLDER/01.html should be returned with代碼403 但它不起作用。 我嘗試了很多組合: "/SUBFOLDER/*""/SUBFOLDER/*.html"等等,有或沒有前導/ 沒有效果。

可能有一些我不明白的地方,但我無法調試我的錯誤。 我錯過了什么?

快速回答我自己的問題,從 misc@openbsd.org 獲得:根據手冊man httpd.conf以防位置語句第一次匹配獲勝。 為了避免忽略一些更具體的規則,有必要將它們放在更全局的規則之前。 在我的情況下,在log style combined之后放置阻塞指令解決了這個問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM