lighttpd (pronounced “lighty”) is a lightweight open-source web server designed for high concurrency with a small memory footprint, using a single-threaded, event-driven architecture instead of one process or thread per connection. Among web servers, it occupies the niche between full-featured platforms such as Apache and Nginx and minimal embedded HTTP daemons.
Released under the revised BSD license, lighttpd is common on embedded devices, routers, network appliances and small virtual machines, and it still serves static content and FastCGI applications on general-purpose servers where predictable resource use matters more than a large module ecosystem.
How lighttpd handles connections
lighttpd processes requests in an asynchronous event loop: one main process watches many sockets at once and reacts only when a socket becomes readable or writable. The server relies on the operating system’s scalable event interfaces, such as epoll on Linux, kqueue on BSD and macOS and /dev/poll or event ports on Solaris, with poll and select as portable fallbacks.
Because idle keep-alive connections cost only a small state structure rather than a blocked thread, a single instance can hold thousands of concurrent connections within a few megabytes of RAM. Static files are sent with zero-copy system calls such as sendfile, which move data from the page cache to the socket without passing through user space.
Dynamic content is never executed inside the server. lighttpd forwards such requests to external backends through FastCGI, SCGI, CGI or HTTP proxying, which keeps the core small and isolates application crashes from the web server itself.
The table below lists the main building blocks of a typical lighttpd deployment.
| Component | Role | Typical configuration |
|---|---|---|
| Event loop | Multiplexes all client sockets | server.event-handler = “linux-sysepoll” |
| mod_fastcgi | Passes requests to FastCGI pools | PHP-FPM socket or spawned processes |
| mod_proxy | Forwards requests to HTTP backends | Application servers on local ports |
| mod_rewrite | Rewrites request URLs internally | url.rewrite-once rules |
| mod_openssl | Terminates TLS connections | ssl.pemfile and ssl.privkey |
| mod_deflate | Compresses responses on the fly | gzip, deflate, brotli or zstd |
Configuration model and modules
lighttpd is configured through a single file, usually lighttpd.conf, written in a declarative key-value syntax with conditional blocks. Conditionals match on request properties such as $HTTP["host"], $HTTP["url"] or $SERVER["socket"], so virtual hosts, per-directory rules and listening sockets are all expressed with the same construct.
Functionality comes from loadable modules listed in server.modules. There is no per-directory override file comparable to .htaccess, which means every rule change requires editing the central configuration and reloading the server. This design favors performance and predictability over delegated configuration on shared hosting.
The following settings have the greatest effect on capacity and behavior.
| Setting | Purpose | Common value range |
|---|---|---|
| server.max-connections | Caps concurrent client connections | 1,024 to 16,384 |
| server.max-fds | Limits open file descriptors | About twice max-connections |
| server.max-keep-alive-requests | Requests allowed per connection | 100 to 1,000 |
| server.max-keep-alive-idle | Idle seconds before closing | 5 to 30 seconds |
| server.max-worker | Number of worker processes | 0 to 4, usually 0 |
| server.stat-cache-engine | Caches file metadata | simple or inotify |
Running more than one worker is possible but rarely needed, because a single event loop can saturate a network link when serving static files. Extra workers mainly help on multi-core systems with TLS-heavy traffic, and they complicate features that keep shared state.
lighttpd compared with other web servers
lighttpd shares its event-driven design with Nginx and Caddy, but it differs in ecosystem size, configuration style and typical deployment. Apache, by contrast, can use process- or thread-based multi-processing modules and supports .htaccess files, which explains its long dominance in shared hosting.
| Server | Architecture | Typical strength | Main limitation |
|---|---|---|---|
| lighttpd | Event-driven, single process | Very low memory use | Smaller community and module set |
| Nginx | Event-driven, multiple workers | Reverse proxy and load balancing | No per-directory overrides |
| Apache | Prefork, worker or event MPM | .htaccess and broad modules | Higher memory per connection |
| Caddy | Go runtime with goroutines | Automatic HTTPS by default | Larger binary and memory baseline |
| OpenLiteSpeed | Event-driven with LSAPI | Fast PHP through LSAPI | Partial .htaccess compatibility |
In practice, Nginx has displaced lighttpd in most high-traffic web hosting, largely because of its richer proxy, caching and load-balancing features. lighttpd remains the pragmatic choice for constrained hardware, where its binary size and baseline memory use are decisive.
Where lighttpd is used and how to deploy it
lighttpd fits workloads where the server must stay small, stable and easy to audit. Router and network-attached storage firmware, single-board computers, local management dashboards and static asset hosts are typical examples. The lighttpd 1.4 branch is the actively maintained line and has gained HTTP/2 support, modern TLS libraries and current compression algorithms.
The decision table below summarizes when lighttpd is a sensible choice.
| Situation | Recommendation | Reason |
|---|---|---|
| Embedded device with 64 MB RAM | Use lighttpd | Small footprint and predictable memory |
| Static site on a small VPS | lighttpd or Nginx | Both serve files efficiently |
| PHP application via PHP-FPM | lighttpd with mod_fastcgi | Clean separation of web and PHP tiers |
| Shared hosting with user overrides | Prefer Apache | Customers expect .htaccess files |
| Complex load balancing and caching | Prefer Nginx | Richer proxy and cache features |
A sound deployment runs lighttpd as an unprivileged user after binding to ports 80 and 443, restricts the document root, enables only the modules the site needs and places PHP or Python applications in separate FastCGI or proxy backends with their own resource limits.
Limitations and common mistakes
The main weakness of lighttpd is its smaller ecosystem: fewer third-party modules, fewer tutorials and fewer administrators who know its configuration syntax. Some historic problems, such as a memory leak in older 1.4 releases and the abandoned 1.5 branch, still shape its reputation even though current releases are stable.
| Symptom | Likely cause | Fix |
|---|---|---|
| Rewrite rules silently ignored | mod_rewrite not loaded or order wrong | Add the module and test rule order |
| “Too many open files” errors | server.max-fds set too low | Raise max-fds and the OS ulimit |
| PHP returns 503 errors | FastCGI backend down or overloaded | Check the socket and process pool size |
| Slow responses under load | Blocking backend, not the server | Scale or tune the application tier |
| Migrated .htaccess rules fail | No per-directory configuration | Translate rules into lighttpd.conf |
A frequent misconception is that an event-driven server makes slow applications fast. lighttpd only removes connection overhead; the backend’s throughput still sets the ceiling for dynamic pages.
The short version
lighttpd is a small program that delivers web pages to browsers. Its main advantage is that it needs very little memory and processor power, so it works well on modest hardware such as home routers or tiny servers.
Think of a single waiter who takes orders from many tables by moving quickly between them instead of standing at one table until the meal is finished. That is how lighttpd handles many visitors at once. The key takeaway is that it trades a large feature set for efficiency and simplicity.
Where it makes a difference
A manufacturer of network-attached storage boxes needs a web interface for its devices, which ship with 512 MB of RAM shared by the file system, the sharing services and the management tools. The engineering team chooses lighttpd because the server runs in a few megabytes of memory and its configuration file is short enough to review line by line.
The interface consists of static HTML and JavaScript served directly by lighttpd, while a small management application runs behind mod_fastcgi on a Unix socket. TLS is terminated with mod_openssl using a certificate generated on first boot.
During testing, the web interface stays responsive with hundreds of open browser sessions while a large file copy saturates the disks. The outcome is a management console that never competes noticeably with storage services for memory, which is exactly the constraint the hardware imposes.