Lighttpd Local Development Guide
Installation, default port, and static/PHP site configuration of the lightweight web server Lighttpd on localhost.
Lighttpd (pronounced “lighty”) is a lightweight, low-memory web server suitable for embedded devices and resource-constrained environments, and can also be used for local static sites or PHP development.
Default localhost Access
| Purpose | Address |
|---|---|
| Default Site | http://localhost |
| Custom Port | http://localhost:8080 |
By default, it listens on port 80, which can be modified in lighttpd.conf using server.port.
Installation
- Linux:
sudo apt install lighttpd - macOS:
brew install lighttpd
Website Root Directory
The configuration file is usually located at /etc/lighttpd/lighttpd.conf (Linux) or under the Homebrew prefix directory.
Key configuration:
server.document-root = "/var/www/html"
index-file.names = ("index.html", "index.php")Enable PHP (Optional)
Install lighttpd-mod-fastcgi and configure FastCGI to point to PHP-CGI to run PHP on localhost.
Common Commands
sudo lighttpd -t -f /etc/lighttpd/lighttpd.conf # Test configuration
sudo systemctl start lighttpd
sudo systemctl reload lighttpdFrequently Asked Questions
403 / 404
Check the document-root path and file permissions.
Port Conflicts with Apache/Nginx
Change server.port = 8080, and use http://localhost:8080.
Summary
Lighttpd consumes minimal resources, making it suitable for lightweight local sites. After configuring the document-root, access it via http://localhost.