uhttpd

uHTTPd

 

最少設定

config 'uhttpd' 'main'
    option 'listen_http' '80'
    option 'home' '/www'

 

 

設定檔:

/etc/config/uhttpd

config uhttpd main
        list listen_http        0.0.0.0:80
        list listen_https       0.0.0.0:443      <----- 要安裝 uhttpd-mod-tls 才有效
        option home             /www
        cert                          /etc/uhttpd.crt
        key                          /etc/uhttpd.key
        script_timeout                60
        network_timeout            30
        index_page                    index.html, index.htm, default.html, default.htm
        no_symlinks                    0
        no_dirlists                        0

 

config uhttpd 'secondary'
    list listen_http '0.0.0.0:8080'
    option home '/www2'
# Reject requests from RFC1918 IP addresses
    option rfc1918_filter '0'
# Maximum number of concurrent requests.
    option max_requests '50'
    option network_timeout '30'
# send probes periodic  to detect dead peers
    option tcp_keepalive '3'
# Configuration file in busybox httpd format
    option config 'none'
#
    index_page                    index.html
    
    
root@WiFi:/etc/config# netstat -lntp | grep uhttp

tcp        0      0 0.0.0.0:8138            0.0.0.0:*               LISTEN      1830/uhttpd
tcp        0      0 0.0.0.0:8080            0.0.0.0:*               LISTEN      1836/uhttpd

 

 

其他功能:

Authentication areas:

Password 儲存在:

/etc/httpd.conf

# 在 /etc/config/uhttpd 有句 "option config   /etc/httpd.conf"

設定格式:

.............................
option realm SomeString
prefix:username:password
.............................

 

建立密碼:

uhttpd -m mysecret

$1$$BMHl56vLZMVWKZbfX9oFN.

Example:

option realm Protect Luci
/cgi-bin:tim:$1$$BMHl56vLZMVWKZbfX9oFN.

 

P.S.
    用 # comment out

 

URL decoding:

uhttpd -d "An%20URL%20encoded%20String%21%0a"

最後要 /etc/init.d/uhttpd restart 才生效

Creative Commons license icon Creative Commons license icon