🛠 Héberger un service web léger (nginx et conteneurs)
Objectives
Turn the Orange Pi PC into a small permanent server: 1 GB of RAM, four Cortex-A7 and a 100 Mbit/s Ethernet link are more than enough for nginx, an ad blocker like Pi-hole or small containers — the use cases Armbian documentation documents for this board. The real subject of a server on an SBC is not the server, it is longevity: fragile microSD and power supply, hence log2ram and sober services.
Hardware
- Orange Pi PC running Armbian, quality 5 V / 2 A power supply (DC jack)
- Brand-name Class 10 microSD, log2ram active (check: systemctl status log2ram)
- Ethernet cable, reserved IP on the router side (SSH tutorial)
- Optional: sudo apt install docker.io for the containers
Full code
- static nginx as a systemd service:
sudo apt install -y nginx
sudo tee /etc/nginx/sites-available/projet <<'EOF'
server {
listen 80;
server_name _;
root /srv/www/projet;
location / { try_files $uri $uri/ =404; }
# Réduire les écritures disque : logs vers stderr (journald, log2ram)
access_log /dev/stderr;
error_log /dev/stderr;
}
EOF
sudo mkdir -p /srv/www/projet
echo '<h1>Orange Pi PC opérationnel</h1>' | sudo tee /srv/www/projet/index.html
sudo ln -sf /etc/nginx/sites-available/projet /etc/nginx/sites-enabled/default
sudo nginx -t && sudo systemctl reload nginx
- first container (the ARMv7 registry is labelled arm32v7/armhf):
sudo systemctl enable --now docker
docker run -d --name whoami --restart unless-stopped -p 8080:80 traefik/whoami
curl -s localhost:8080 | head -3
# Limiter l'empreinte : logs JSON sur petit fichier, rotation agressive
sudo tee /etc/docker/daemon.json <<'EOF'
{ "log-driver": "json-file", "log-opts": { "max-size": "1m", "max-file": "1" } }
EOF
sudo systemctl restart docker
- Backup: tar of the configs + card cloned regularly (dd | gzip).
Expected verification
curl localhost returns the page; from another machine, http://IP-de-la-carte too. docker ps shows the container in restart unless-stopped and it restarts on its own after reboot. The temperature stays below the throttling zone at idle (nginx alone barely heats).
Common errors
- Ignoring the 100 Mbit/s limit: this server will never be a multi-stream media server; dimension accordingly.
- Letting logs write continuously on the microSD: guaranteed corruption in the medium term — hence log2ram and access_log to journald.
- Looking for arm64 Docker images: the H3 is ARMv7 32-bit (armv7l), take the arm32v7/armhf variants.
- Counting on WiFi: nonexistent on this model, the cable is mandatory for a server.
- Phone power supply under 2 A: dropouts and corruption under network/disk load.
Other tutorials for this board
Code examples for this board
clignotante.pyPythonbouton-gpio.pyPythoncapteur-i2c.shBashsurveillance-temperature.shBashcapteur-dht11.pyPythonservo-pwm-sysfs.shBash