lighttpd:身份驗證後如何將端口(僅對本地主機可見)轉發到 WAN? (lighttpd: How to forward port (visible only to localhost) to WAN after authentication?)


問題描述

lighttpd:身份驗證後如何將端口(僅對本地主機可見)轉發到 WAN? (lighttpd: How to forward port (visible only to localhost) to WAN after authentication?)

我有一個只能在主機上通過 http://localhost:1234

訪問的網絡攝像頭流。

這個流沒有身份驗證。

我想設置一個輕量級的http服務器,在80端口監聽外部連接,提示輸入用戶名和密碼,然後從localhost:1234

我該怎麼做這個?


參考解法

方法 1:

Lighttpd can do this. The following config files will forward requests to http://domain.com/ => http://localhost:1234/ requesting a http basic auth first.

lighttpd.conf

## Add auth and proxy mods to your existing modules list
server.modules = (
    "mod_auth",
    "mod_proxy"
)


$HTTP["host"] == "domain.com" {

    auth.backend                = "plain"
    auth.backend.plain.userfile = "lighttpd‑plain.user" 

    auth.require = (
        "/" => (
            "method"  => "basic",
            "realm"   => "MyWebcam",
            "require" => "valid‑user" 
        )
    )

    proxy.server = (
        "/" => (
            (
                "host" => "127.0.0.1",
                "port" => 1234
            )   
        )
    )

}

lighttpd‑plain.user

webcamuser:webcampassword

Make sure you load mod_auth before mod_proxy in server.modules, getting them in the wrong order can make lighty panic.

(by tetris11Kinetic)

參考文件

  1. lighttpd: How to forward port (visible only to localhost) to WAN after authentication? (CC BY‑SA 2.5/3.0/4.0)

#lighttpd #authentication #port #apache






相關問題

Lighttpd 單個子域重定向/重寫 (Lighttpd single subdomain Redirect/rewrite)

在 lighttpd 中包含許多重寫指令 (Including many rewrite directives in lighttpd)

lighttpd:禁用 CGI 緩衝 (lighttpd: disable CGI buffering)

lighttpd:身份驗證後如何將端口(僅對本地主機可見)轉發到 WAN? (lighttpd: How to forward port (visible only to localhost) to WAN after authentication?)

在centos 404錯誤中安裝Lighttpd (install of Lighttpd in centos 404 error)

在 Lighttpd 中配置子域 (Configure subdomains in Lighttpd)

如何根據用戶登錄重定向 Lighttpd webdav 掛載 (How can I redirect a Lighttpd webdav mount depending on user login)

如何在 Windows 2003 上使用 mongrel、lighttpd 和 iis 設置負載平衡的 Rails Web 服務器 (how do i set up a load balanced Rails web server using mongrel, lighttpd and iis on windows 2003)

Lighttpd:視頻無法正常流式傳輸 (Lighttpd: Videos not streaming properly)

Apache、lighttpd、nginx、切諾基,什麼是最好的組合? (Apache, lighttpd, nginx, cherokee, what's the best combination?)

web.py + lighttpd + matplotlib 不工作 (web.py + lighttpd + matplotlib not working)

在 lighttpd 中重寫後得到錯誤的 PATH_INFO (Get wrong PATH_INFO after rewriting in lighttpd)







留言討論