Example compose file. The daemon still needs a document root and a config that matches the container paths — see docs/operations.md and docs/configuration.md.
Environment names use underscores (SIMPLE_HTTPD_*). Hyphenated names are ignored.
-
Build the Docker image from the repository root (wherever your
Dockerfilelives):docker build -t simple-httpd:latest . -
Run with Docker Compose:
docker-compose up -d
-
Check status:
docker-compose ps docker-compose logs simple-httpd curl -sS http://127.0.0.1/healthz
These are the variables the binary actually reads:
| Variable | Sets |
|---|---|
SIMPLE_HTTPD_CONFIG |
Config path if --config is omitted |
SIMPLE_HTTPD_LOG_LEVEL |
debug, info, warn, error |
SIMPLE_HTTPD_ADDRESS |
listen_address |
SIMPLE_HTTPD_PORT |
listen_port |
SIMPLE_HTTPD_ROOT |
document_root |
SIMPLE_HTTPD_TLS_CERT / SIMPLE_HTTPD_TLS_KEY |
PEM paths |
A config file is the better place for TLS, vhosts, and rate limits.
| Volume | Description |
|---|---|
./config:/etc/simple-httpd:ro |
Configuration and htpasswd (read-only) |
./www:/var/www/html:ro |
Document root (adjust to match document_root) |
./logs:/var/log/simple-httpd |
Access and error logs |
# Start services
docker-compose up -d
# Stop services
docker-compose down
# View logs
docker-compose logs -f simple-httpd
# Restart service
docker-compose restart simple-httpd
# Update and restart
docker-compose pull
docker-compose up -d
# Remove everything
docker-compose down -vPrefer HTTP:
curl -fsS http://127.0.0.1:80/healthz
nc -z only proves the port is open. /healthz proves the accept loop is serving.
The service uses a custom bridge network (simple-httpd-network) with subnet 172.22.0.0/16.
- Run as non-root user (configured in Dockerfile)
- Read-only configuration volume
- Network isolation with custom bridge
- Resource limits (configure as needed)
# Check logs
docker-compose logs simple-httpd
# Check configuration
docker-compose exec simple-httpd cat /etc/simple-httpd/simple-httpd.conf# Check what's using the port
netstat -tlnp | grep 80
# Change port in docker-compose.yml
ports:
- "8080:80/tcp"# Fix volume permissions
sudo chown -R 1000:1000 ./logsFor production deployments, consider:
- Use specific image tags instead of
latest - Set resource limits in docker-compose.yml
- Configure log rotation for log volumes
- Use secrets management for sensitive configuration
- Set up monitoring and alerting
- Configure backup for data volumes
# Override configuration for development
docker-compose -f docker-compose.yml -f docker-compose.dev.yml up -d# Use production configuration
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d