Score:0

How to wake my Ubuntu server on HTTP requests from LAN?

ro flag

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.

Score:0
cn flag

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.

Youssef Ihab avatar
ro flag
do you have any suggestions on how to set my firewall to send a Magic Packet to turn the server on for http requests?
Michael Cropper avatar
cn flag
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.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.