Table of Contents

uHTTPd webserver

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

Features

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: polarssl, mbedtls, cyalssl, openssl). 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. Since Dec2016 luci-ssl installs by default libustream-mbedtls.

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.

Installation

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

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 also properly provides an init script /etc/init.d/uhttpd to start or stop the service and enable it at boot time.

Using the default installation for publishing files.

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.