Raspberry Pi as a placeholder web-server and as a device to wake up the main server

So, this is the first time I’m actually asking for advice in internet instead of just searching for similar questions and answers.. be gentle 🙂

I want to setup my raspberry pi (raspbian os) to host a “lite” placeholder website, that gets replaced if another server running on my local network is online.

I have a debian box that I use mainly as a host for my personal website and as a dedicated game server.

The debian box takes quite a lot electricity and most of the time it’s running idle. This is why I want to keep it powered off when it’s not needed.

What I want to do is to make the raspberry show the user entering my website a placeholder page. From this placeholder page the user could the (through php-cgi-python) send a WOL-magic packet to the debian box. The debian box would then overtake handling the web requests coming from internet.

So. How do I make it so that when my debian box awakens, the user coming to my website won’t see the site hosted in raspberry, but the site hosted in debian box? And the opposite: When the debian box gets shut down, the raspberry pi takes on hosting the website?

Some information about my setup:

*Both raspberry and debian are connected to my firewalled modem/router. I’ve port forwarded port 80 to Raspberry Pi.

*Raspberry Pi, running latest Raspbian OS

*Old server, running Debian GNU/Linux 8.6 (jessie)

Answer

Consider setting up your Raspberry Pi as a caching server. A user requesting a cached page will be served from the Raspberry Pi. A request for an uncached page will be forwarded to your main server and served from there, waking it up in the process.

Attribution
Source : Link , Question Author : Rytai , Answer Author : Suncat2000

Leave a Comment