2 Answers
2

Giving this answer for the entertainment value mostly, but you could use any super-server (xinetd might do the job, too) and make it run a simple script for every request on port 80. The script would wait for a blank line on standard input and then print a prepared static response. Not sure how much more lightweight you can get.

For example, if using DJB's tcpserver (I find it easy to use for such trivial tasks) you can do:

By default tcpserver looks up information about the incoming connection and -H (do not look up the remote name in DNS) and -R (do not look up remote info with ident) will speed up responding to incoming connections. -u and -g will drop the privileges after receiving the connection on port 80, and you will have to start it as root to be able to listen on port 80.

i had to install the packet ucspi-tcp and then it worked, thx
–
rubo77Nov 2 '12 at 21:50

on my homeserver (ubuntu) it worked, but online i get the error: tcpserver: fatal: unable to bind: address already used
–
rubo77Nov 2 '12 at 22:11

You will have to stop apache from listening on port 80. And for the record, you can tell it to listen on the wildcard address, too 0.0.0.0.
–
chutzNov 3 '12 at 8:24

ah yes, I thought I did apache2ctl stop before, but I didn't. But now I still have this problem: that minimalserver only works on localhost but if i call wget -q -O - http://my-domain.de:1080/ (or :80/): still no output
–
rubo77Nov 4 '12 at 6:06

1

The second parameter is the address to listen on. Specify 0.0.0.0 instead of 127.0.0.1 and it will respond to all IPs.
–
chutzNov 4 '12 at 14:32

Why not (temporarily) apply a redirect rule in Apache to point everything to your sitedown page? (and if you do it via a proxy request rather than a redirect, then any PHP script at that location will be able to read the requested URL). You can swap in a different config without losing anyrequests using a graceful restart.