files and caching
Byte ranges, ETags, gzip, precompressed files and scoped cache policies.
your sites. your server.
a web server, written in zig.
Static files, PHP and apps. Served directly.
01 / configuration
Keep the listener settings in one place. Give each domain its own config. Static site, PHP app or proxy: same server.
host = 127.0.0.1
port = 8080
domain_config_dir = domains-enabled
admin_ui = false
server_name = example.com www.example.com
root = /srv/www/example
index = index.html
serve_static_root = true
Files, ranges, ETags and precompressed sidecars.
server_name = api.example.com
serve_static_root = false
proxy = http://127.0.0.1:3000, http://127.0.0.1:3001
upstream_policy = least_connections
proxy_timeout_ms = 15000
An HTTP upstream pool with health and retry controls.
server_name = app.example.com
root = /srv/www/app/public
serve_static_root = true
php_root = /srv/www/app/public
php_fastcgi = unix:/run/php/php-fpm.sock
php_index = index.php
php_front_controller = true
Use your PHP-FPM socket path. PHP runs separately.
02 / in the server
Byte ranges, ETags, gzip, precompressed files and scoped cache policies.
HTTP proxy pools, health checks, bounded attempts and direct FastCGI for PHP-FPM.
TLS 1.3, ALPN and per-domain SNI certificates. Certificate automation integrates with certbot.
Per-domain files, route overrides, config validation and compatible in-memory reloads.
Structured access logs, metrics, route inspection and upstream diagnostics.
Site management, staged config edits and runtime controls. Off by default; first setup needs a local token.
admin setup and security03 / where it fits
Caddy and nginx have years of production use behind them. Layerline is younger. Here's the comparison without pretending otherwise.
| capability | Layerline | Caddy | nginx |
|---|---|---|---|
| written in | Zig | Go | C |
| HTTP/1.1 + HTTP/2 | native implementations | included | HTTP/2 module |
| HTTP/3 | experimental | included | optional, experimental module |
| HTTPS | native TLS 1.3; certbot integration | automatic HTTPS | configured TLS certificates |
| PHP-FPM | direct FastCGI | php_fastcgi directive | FastCGI module |
| management | optional web UI + local socket | admin API | config files + CLI |
Selected open-source capabilities. Builds and configuration matter. Sources: Caddy, Caddy PHP, nginx docs, nginx HTTP/3.
a note before you deploy
I'm building this to run sites without Caddy or nginx in front. It's not a drop-in replacement yet. HTTP/3 interoperability, longer soak tests and more runtime hardening are still on the list.
the actual roadmap04 / give it a run
You'll need Zig 0.16. This starts a local server on port 8080, with the admin UI off.
deployment guidegit clone https://github.com/raya-ac/Layerline.git
cd Layerline
zig build run -- --config examples/local.conf
then open 127.0.0.1:8080