Updated: 11 October 2026 · Applies to: Ubuntu 24.04 LTS
Ubuntu 16.04 is no longer supported, so this guide now uses Ubuntu 24.04 LTS (Debian 12 works the same way).
lighttpd is a small, fast web server that suits low-memory servers and simple sites.
Install
apt install lighttpd systemctl enable --now lighttpd
Open the firewall
ufw allow 80,443/tcp # Ubuntu / Debian with UFW firewall-cmd --permanent --add-service=http --add-service=https && firewall-cmd --reload # AlmaLinux / Rocky
Add PHP
apt install php-cgi lighty-enable-mod fastcgi fastcgi-php systemctl reload lighttpd
Configuration
- Main file:
/etc/lighttpd/lighttpd.conf; web root/var/www/html. - Virtual hosts:
$HTTP["host"] == "example.com" { server.document-root = "/var/www/example.com" }. - Check the syntax with
lighttpd -t -f /etc/lighttpd/lighttpd.conf.
For HTTPS, use Certbot in standalone or webroot mode and enable mod_openssl.