https://www.cnblogs.com/163yun/p/9834993.html
安装uhttpd。
在编译openwrt前,输入make memuconfig,查找Network -> Web Servers/Proxies -> uhttpd,如果没勾选则勾选。然后编译固件。
修改uhttpd配置。
安装运行openwrt后,通过ssh登陆,修改/etc/config/uhttpd配置文件,在文件末尾添加新的web服务。添加数据基本格式如下:
config 'uhttpd' 'ServerName' option 'home' '/root/' list 'listen_http' '0.0.0.0:8080' option 'cgi_prefix' '/cgi-bin'
其中:
名称 | 说明 |
uhttpd | 服务名称,不要和系统的重名即可 |
home | 服务的根目录 |
listen_http | CGI前缀,用来区分是否调用的CGI |
cgi_prefix | CGI前缀,用来区分是否调用的CGI |
还有其他配置,不一一列举,比如index_page 、error_page 、listen_https、cert、key、script_timeout、network_timeout、tcp_keepalive等。
修改后需要重启uhttpd,使用命令:
/etc/init.d/uhttpd restart
配置静态页面。
在服务的根目录下配置web页面,比如index.html(如果uhttpd配置未指定,则为默认页面)。如下是一个网上找到的登陆网页