0

I have an Ubuntu 22.04.1 web server running Apache2 Server hosting 2 sites [Django website & other File hosting Site]. What I'm trying to achieve: Set the server to sleep all the time it is not in use. when it receives an HTTP request, It wakes for 20 min. (To give clients some time to use the website) then go to sleep.

I've dealt with the 2nd part by setting the ubuntu auto sleep timer to 20min. and it worked (it sleeps after 20 min. of waking)

My Problem is with the 1st part. After days of research and trying, I can't find a way to make the server wake on HTTP requests only. I have Tried ethtool's wol, all the 'pumbg' options but the server Wakes on random times without sending any requests to the server.

1 Answers1

0

This isn't possible. HTTP Requests are handled by the web server that lives inside your Ubuntu server. If your Ubuntu server virtual machine is off then the inbound traffic will never reach the web server that sits inside it.

At best you'll probably be best using WOL (Wake On Lan) technology within your firewall to send a Magic Packet to turn the virtual machine back on and ensure your web server is set to auto-start on boot.

Michael Cropper
  • 382
  • 2
  • 5
  • 13
  • do you have any suggestions on how to set my firewall to send a Magic Packet to turn the server on for http requests? – Youssef Ihab Mar 27 '23 at 14:50
  • I can often work miracles @YoussefIhab but I can't walk on water. Help me out here buddy :-) Draw my a diagram of what your setup is and some more details of your specific use case. In reality though, if you're looking for HTTP to WOL, then it's probably not going to be possible with ease as you're leaping the layers in the OSI Model. Update your question with more specifics on the use case. With cloud services available, there are many alternatives. – Michael Cropper Mar 29 '23 at 21:04