uHTTPd webserver

uHTTPd is configured to be the default LuCI web interface for OpenWrt. It is a web server written to be an efficient and stable server, suitable for lightweight tasks commonly used with embedded devices and proper integration with OpenWrt's configuration framework (UCI). In addition, it provides all the functionality expected of present day web servers.

Its source code is available in the following git repository:

Built as a general purpose HTTP daemon, uHTTPd is not merely intended for running the OpenWrt's web interface but has functionality up to par with any other modern web server. Included is support for TLS (SSL), CGI and Lua. It is single threaded but supports multiple instances (i.e. multiple listen ports, each with its own document root and other features).

uHTTPd is built by default (since r35295 in Jan2013) to support the usage of TLS (HTTPS) via a libustream-* SSL library (on top of an actual SSL library: mbedtls (formerly polarssl), openssl, wolfssl (formerly cyassl)). Previously the package uhttpd-mod-tls was required, but it is not needed any more as long as you have installed a libustream library variant. In Dec 2016 luci-ssl installed by default libustream-mbedtls. In Aug 2020 luci-ssl installed by default WolfSSL. Since Feb 2023 luci-ssl switched back to mbedtls installing libustream-mbedtls by default.

In contrast to many other web servers, it also supports running Lua in-process, which can speed up Lua CGI scripts. Note that LuCI, which depends on Lua, is not configured in this manner by default.

uHTTPd is the standard HTTP server for OpenWrt, but it is not included by default in the system image for the main OpenWrt releases. The package name is uhttpd. Installation can be done with:

opkg update
opkg install uhttpd

However, it is usually installed automatically as a dependency for the web interface LuCI. Installing a web interface for administering an OpenWrt device therefore only consists of installing the web interface, in this case LuCI. See the LuCI on uHTTPd configuration page to get started. Of course, you can use a web interface with any other web server.

Configuration of uHTTPd integrates nicely with OpenWrt's user interface system, through standard uci. The UCI configuration file is /etc/config/uhttpd. Since uHTTPd depends on this file directly, there is no second configuration file that gets written by UCI when settings are committed (like is the case with many other applications, such as Samba). Since uHTTPd is configured as part of the UCI system, refer to the uHTTPd UCI configuration page. uHTTPd can be managed by the uhttpd service.

One could use the default installation for publishing files. A quick example is to disable the redirect to luci scripts.

mv /www/index.html /www/index.html.orig

Done this anything is shown as list of file and even symbolic links works.

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
  • Last modified: 2023/10/14 06:02
  • by vgaetera