🛠 Serveur web ultra-léger ou conteneurs sur 256 Mo

Raspberry Pi Model A (2013) — Board Sheet · avance · Schéma : IMG-model-a-avance-9-modela-serveur-leger.svg — Raspberry Pi Model A servant de petit serveur web : page HTML servie par busybox httpd sur le port 8090, dongle WiFi en amont, jauge mémoire montrant l'espace disponible sur les 256 Mo

Objectives

Hardware

Complete code

# Option 1 — busybox httpd : ~0 dépendance, empreinte minimale
mkdir -p /srv/www && echo '<h1>Model A en ligne</h1>' > /srv/www/index.html
nohup busybox httpd -p 8090 -h /srv/www -f &

# Option 2 — service systemd pour le redémarrage automatique
cat > /etc/systemd/system/tinyweb.service <<'EOF'
[Unit]
Description=Serveur web busybox
After=network-online.target
[Service]
ExecStart=/usr/bin/busybox httpd -p 8090 -h /srv/www -f
Restart=always
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl enable --now tinyweb

# Test local
curl -s http://localhost:8090/

Expected verification

curl returns the HTML; from a laptop: http://raspberrypi.local:8090/. free -m shows that the server uses a few MB and that there is still headroom. >

Common errors

Other tutorials for this board

Code examples for this board

← Back to the board 🛠 All tutorials