TSWS, A Totally Simple Web Server in Bash and Netcat.
git clone https://github.com/dfletcher/tsws.git
cd tsws
./tsws 127.0.0.1 8080 &
chromium http://127.0.0.1:8080
TSWS_LIBRARY=1 . tsws
declare www_index_Content_Type="text/html; charset=utf-8"
function www_index {
echo "<html><body>My index is better than the default.</body></html>"
}
tsws 127.0.0.1 8080
Have a look at the source code for many more details and discussion, including theory of opreation and creating dynamic content.