#!/usr/bin/env bash set -euo pipefail # Make a minimal HTML page IP="$(hostname -I | awk '{print $1}')" cat > index.html < Hello World

Hello from $(hostname)

IP address: $IP

EOF # Serve forever on port 80 with netcat echo "Serving on http://$IP (Ctrl+C to stop)" while true; do { echo -e "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n"; cat index.html; } | nc -l -p 80 -q 1 done