[rescue] re: Minimal Web Server

Sheldon T. Hall rescue at sunhelp.org
Sun Oct 21 15:39:46 CDT 2001


In Message: 2 on Date: Sat, 20 Oct 2001 22:00:15 -0400, Brian Hechinger
<wonko at arkham.ws> declaims, on the Subject: Re: [rescue] Minimal web server
....

>> I'm a bit late, as I haven't seen it mentioned:
>> try thttpd, www.acme.com/software/thttpd/
>>
>> I have it running on my 3/160, but I know people
>> who also use it for real heavy duty work on sites
>> with mostly static content, like serving images
>> or downlaods.
>
> hmmmm, maybe i need to install 2.11BSD on my PDP-11/83 and port that.
turn my
> PDP-11 into my main web server. :)

Or maybe just a Bourne-shell script ... it only takes 6 or 8 lines to do
straight webserving:

/users/shel $ cat /usr/local/httpd
#!/bin/sh
#
# A more-or-less HTTP/0.9 Daemon that works with most browsers.
# All page refs are relative to $W.  Created 7/7/99 by Sheldon T. Hall

PATH=/bin
W="/usr/local/webpages"
E=${W}/404.html

serve() { cat $1 2> /dev/null || ( echo "HTTP/1.0 404 Not Found" ; cat
$E ) }

read C F P ; GF=$W/$F                   # Browser sends "GET / HTTP/1.0"

echo $GF | egrep -s "\.\./" && GF=$W    # Deflect "../" attempts

if [ -f "$GF" ] ; then serve $GF ; else serve $GF'/index.html' ; fi

/users/shel $




More information about the rescue mailing list