Note: This post and the accompanying software packages have been updated several times since this was originally posted. The most up-to-date releases and instructions can always be found in the GitHub Repo. Update notes are appended to the end of this blog post. The V3 Beta release automates most of the setup process, incorporates Dynamic DNS Auto-Updating, and supports signed HTTPS.
I have a very power hungry desktop computer. When I’m travelling with my laptop, I can’t carry all my files and data with me, so I occasionally use “remote desktop” to access my desktop from the road. I also use a Plex Media Server to stream content from my desktop computer. However, the computer has to be on for me to be able to do this. This means I need to leave the computer on all the time, just in case I need to access it. This wastes power, costs me money, and harms the environment. My Raspberry Pi, on the other hand, consumes a minuscule amount of power, and is always on anyways, serving other purposes. In this tutorial, I’ll show you how to run a simple mobile-friendly website from your Raspberry Pi that will allow you to remotely wake up your power-hungry computer, so you can remotely access it. When you’re done, just put it back to sleep from within the remote desktop service (or use the mobile app plus a small background server running on your desktop to put it back to sleep – this is described in the instructions). The app pings the computer from the Raspberry Pi to inform you of when the computer has woken up and established network connectivity. Follow along after the break…
Once you’re done setting up your Pi-Powered Wake/Sleep on LAN Server, here’s how it will work…
- From wherever you are in the world, navigate to your unique, dynamically updating URL (wol.example.com)
- You’ll be presented with a screen that looks like the one below (note, you may get a security popup first, if you choose to use a self-signed certificate to enable HTTPS – this is described in the instructions). From this screen, you can select which machine you want to control, and you can view its state (awake or asleep). You can add as many machines that you want to control. Here, you can see that “Phoenix Desktop” is currently awake, and I have the option to put it to sleep:
- Next, you’ll enter a passphrase that you’ve pre-chosen. If the wrong phrase is entered, a “denial” note will pop up, and you’ll be able to try again. If you enter the right phrase, the Raspberry Pi can send a “Wake Up” or “Sleep” command to the remote machine. It will then ping that computer and display the results in real-time, so that you know when the computer has finished booting or when it has finished going to sleep. Here, you can see what that screen looks like when I put “Phoenix Desktop” to sleep remotely:
- You’ll receive a confirmation message when the computer has finished waking up or going to sleep. If you just woke it up, you can now perform normal remote access tasks, like SSH, FTP, or Windows Remote Desktop.
Ready to set this up for yourself? Visit the GitHub Project Wiki to follow the detailed installation instructions.
- 7/20/2013: Added the ability to put the computer back to sleep using the mobile webapp. Instructions updated on the Wiki.
- 12/15/2013: The app now includes a dropdown that allows you to pick a computer. You can now Wake/Sleep as many computers as you want! Thanks to GitHub user ahodgey for submitting a Pull Request with most of this functionality (I made some updates to his pull request, and merged it into the master repository branch).
- 09/14/2015: The Raspberry Pi WOL software now supports self-signed SSL encryption, meaning you can connect over HTTPS using a self-signed certificate. Additional security measures have also been implemented to reduce the risk of XSS vulnerabilities. Thanks to GitHub user felixrr for the Pull Request! You can still use ordinary HTTP if desired, and updated instructions can be found on the Wiki.
- 01/24/2015: Software bumped to v2.0. Fixed lots of bugs, and confirmed working latest Raspbian Jessie release, with Apache 2.4.x (which had a bunch of breaking changes).
- 01/31/2021: An x86 Docker Image is now available for this application (for Desktop, not Raspberry Pi). I have not independently validated its performance, but it pulls directly from my Repo. It’s available on DockerHub here.
- 02/21/2021: The V3 Beta release automates most of the setup process, incorporates Dynamic DNS Auto-Configuration, and supports signed HTTPS. Follow the V3 Wiki Instructions to install it!
Supporting Documentation and Code
This project is licensed the GNU GPL v3. Please Attribute and Share-Alike. You can download the source directly from the GitHub Repository linked below.
Thanks for the tutorial/script! It works great!
The script cannot ping my computer because I have to set my broadcast IP (192.168.178.255) for waking up my clients.
Can you please tell me how to edit the script so I can use my broadcast IP for waking up clients, and the scripts ping’s to the clients IP (192.168.178.50) and not to the broadcast IP?
thanks for the guide got a raspberry pi with no idea how to use linux got it all working pretty easily following this guide this is going to save me a fortune i was often having to leave my pc on all day when i went out to access plex and view my webcam to check in on the dogs the electric bill was through the roof with the pc on all the time.
Awesome guide! and awesome script. Thanks.
I got almost everything working. It will “sleep” with sleep on lan and it will wake from a complete shutdown, but it will not wake from suspend/hibernate (whichever sleep on lan uses) any idea why?
I’ve enabled WOL in my bios and made sure the NIC was set to not power off.
Thanks a lot!
You’re a god!
It works perfectly :)
So i have an issue i can access my webserver when im on my local network but i can’t when im outside my network how do i fix this
Hi, I first set this up about a year ago and after a few problems i got it all working great. But I’ve just recently purchased a few more machines at home and wanted them to be able to wake on lan. All i’ve done is added one machine to the config file, and now no matter how i attempt to access the webpage all i get is a blank page. Any Ideas?
Whenever i use this to get computer to sleep, it wakes up in some time?
Thanks for this, just to let you know its working on OS X Yosemite too.
For anyone else with a mac, this technique works fine, but you need to use port 4343
It won’t put the mac to sleep however.
Hi, firstly thanks for a great tutorial!!!
I am complete Pi noob and only bought the wonderful little device specifically after finding this tutorial as remote WOL was something I have looking at doing for a while….
Anyway, I have managed to get everything working OK apart from the “sleep on lan” part, mainly as the link you provide to the “sleep on lan” Windows program does not seem to work at the moment.
Can anyone who has already downloaded share a link? Thanks so much!!
Worked a treat (after a few hiccups), thanks a million for the cracking tutorial.
hey, whenever im loading this up on the page im getting the debian Apache webpage, have reinstalled and reconfigured the config file numerous times
please advise on steps needed to rectify
You have to delte the index.html in /var/www, that contains the standard debian apache site.
You really saved me a lot of wasting time. Great application and great article!!!
Thanks for this!
There does seem to be an issue with bootstrap.min.js
it throws an error “Uncaught TypeError: e is not a function” when you look at the console output in Chrome Developer Tools.
Any ideas ?
The Sleep-on-LAN Windows client webpage seems to be down for a while now. Does anyone have the files they can share with me?
I realize you’ve resolved this, but I mirrored the software on my server and I now provide an alternative download link in the post so that this doesn’t happen again.
About the Sleep tool – currently I have to be logged on to the Computer to shut it down remotely. Any way to set it up so I don’t have to be logged in?
I tried to get sleep on LAN to work as a Windows service for this reason but it doesn’t work. No fix I know but look at Teamviewer for remote access if you haven’t alrady.
The Sleep On LAN webpage is back. Installed and all working!!!
I have this working well, can WoL from anywhere, thank you, I can also shutdown my computer from anywhere using the SoL utility, however after using SoL to shutdown my computer I can no longer wake it using WoL. It works fine if I shut it down normally. Any ideas why this is happening?
Note sure. Different computers will behave differently. Sometimes you can change sleep settings to change how “deep” of a sleep it goes into.
Great tool. Thanks for tutorial.
Sleep on lan “suspend” mode puts the computer to hibernate mode instead of sleep mode!
It depends on the computer. You may need to make config changes on your machine to change whether it goes to sleep or hibernate.
Nice work! Still have to try the sleep-on-lan feature, but the one I really needed was the wake-on-lan part. :)
Will this work on Raspberry Pi 2?
in case people are having problems with this on windows 10 machines (could also apply to windows 8) where the Pi, can see the state of the machine but it won’t turn it on, the problem is most likely that fast boot is enabled. after disabling it within windows the WOL server works again. below is a link to a page that shows how to disable fast boot.
Can you please provide instructions to completely remove the pass phrase and login functions so the webpage just contains the Wake Up! button. I have zero experience in Python and minimal experience in Linux. I would greatly appreciate it if you could help me.
Hi Sachila – I can’t recommend this. This script is designed to be accessible outside of your network (and therefore to anybody on the internet). It would be unwise to give anybody access to controlling your hardware with no kind of passphrase. Why do you want to remove the passphrase?
I want to disable the pass phrase because I’m accessing my wol Pi over a secure vpn tunnel that I also run myself, and has secure encryption and password protection.
That and also because it is really annoying to have to remember a hash and carry it around with me everywhere.
In addition, I can’t seem to get the hash to work, no matter what I do (I went to the website you recommended to get a hash) the hash doesn’t work as a password. Yes, I did remember to edit the config with the hash.
Is there any way for me to edit the code to remove the password aspect of it?
You don’t remember the hash – you remember the password that generated the hash. In other words, if you want your password to be “hello”, you enter “hello” into the 1-way hash generator, and copy the resulting hash into the config file. Then, when you visit the WOL portal, you enter “hello” as your password, the Pi does a one way hash on that, confirms that it matched the hash you have in the config file, and it lets you in.
You could generate the hash of an empty string and use that without making any code modifications. Or, if you don’t want to see the passphrase box at all, the simplest change would be to change the type of the “password” input element from “password” to “hidden”. Then prepopulate it with the appropriate password, so it’s sent on your behalf each time.
How can I go about doing that?
Can’t get it to work. I’ve followed the installation to the letter. I have everything set up, but when I navigate to my RPi, I don’t get the website. I’m installing this on OSMC (Debian, Jessie). Can someone help me out?
Fix: Place files from /var/www to /var/www/html
Sleep function is nice, but when testing the computer still pinged so I disabled this by editing index.php changing $pinginfo = “”. Of course I now lose the functionality of putting my PC to sleep, but it kept saying it was alive when it was actually off. (for 5 seconds).
Thanks for the tutorial! I guess it didn’t work out of the box because some things have changed in the meantime. It’s really useful as my router blocks WOL from outside when my PC is out of the ARP. It does allow WOL from inside, which is where this is really useful!
hi, thanks for the tutorial.
but i have some questions. i can access my web server locally, but i can’t access it outside the network.
i have tried port forwarding, but it still not working.
now, i can only access the web server with 192:168:xx:xx, but i can’t access it with WAN:80 (outside my LAN)
please advice. thanks
Many ISPs block access to port 80. Try forwarding a different external port to internal port 80.
Many thanks for this guide, I an very new to Pi so please forgive me!
On the line “sudo mv -f Remote-Wake-On-LAN-Server/apacheconfig /etc/apache2/sites-enabled/000-default” I’m getting an error saying no such file or directory. When I do a LS I see on my Pi the directory it’s installed actually says Remote-Wake-Sleep-On-Lan-Server but even if I amend the line of code to include the word Sleep (correct path) it doesn’t work.
Have any recent updates broken the instructions from
I’ve also tried running the command from with then correct directory but still errors, any pointers would be most welcome!
Hi Sarah – sorry about that. I did recently make an update, and I made a mistake in the Readme. I just updated the readme to fix it (see this commit). Let me know if you still have issues.
If I am not mistaken there is a small “typo” on https://github.com/sciguy14/Remote-Wake-Sleep-On-LAN-Server/blob/master/README.md
git clone https://github.com/sciguy14/Remote-Wake-Sleep-On-LAN-Server.git
and later on (during SSL)
git clone https://github.com/sciguy14/Remote-Wake-On-LAN-Server.git
So you are missing the “SLEEP”in the second line.
Small error and I had to read it 4-5 times before I saw what was going wrong.
Thanks Henk! I just fixed it :)
I had problems getting the ping to work (it always thought it was offline), however it turned out it wouldnt send a ping because of lack of permissions, i fixed this by using:
sudo chmod 4755 /bin/ping
I hope this helps others
I use the WOL on my Raspberry. However, it worked so far but I were always wondering why is says beeing asleep and no really ping reasult back…now it works perfect.
Unfortunately I’m generally a windows user and don’t automatically think about the situation that almost everything (if you are not root) has to be granted on a Linux system to let it work – Sure save somehow but stupid as well.
Anyway, thank again now it works perfect.
I have been using this for the last few months and its been working great!!! but I tryed to reinstall it again today and i get the following error message
‘/etc/apache2/conf.d/security: No such file or directory’
after this line
‘sudo sed -i.bak “s/ServerSignature On/ServerSignature Off/g” /etc/apache2/conf.d/security’
any ideas ?
@mylo – I am having the same issues and my guess is that it is due to me using Jessie rather than Wheezy. This may be a long shot but it could have something to do with Apache 2.4’s requirement for config files to have a .conf extension or something related to them as the web server works until we start messing with them.
Hey folks – could you post this as an issue on Github, and I’ll try to get it resolved?
Been using this utility for a while and very useful indeed thanks. After a recent upgrade to Windows 10 I found that if the desktop PC was in sleep more it woke fine, but if powered off it did not. Some research showed that the Windows 10 fast startup was the culprit – if this is enabled wake on LAN did not work. If disabled, all good.
More to this and good news – my motherboard Asus P5B has two LAN ports. I had been using the Marvell Yukon one and this gave me the results in the above post. I got the Realtek one going by installing Windows 8.1 drivers and now I can wake Windows 10 when it has been shutdown in the fast startup mode.
Would it be possible to run something like PHProxy on the same network (and hopefully even the same Pi) while this is running, or is the only public port taken?
Yes – it’s possible. You can make any port public. All you have to do it run something on that port on the Pi, and forward it through your router. If it’s the non-default port (80 for HTTP or 443 for HTTPS), you just need to specify it in the URL like so: test.example.com:500 (if you were using port 500 for example).
Alright, I think I figured it out. Turned out not working in general which is a bit sad but the ports worked fine. Thanks for the quick response.
You mean my WOL scripts aren’t working, or the PHProxy software isn’t working? If it’s something wrong with my software, lemme know and we can try to get it fixed :)
The code isn’t working, it keeps trying to send the packet but on the target machine, a packet sniffer I have setup isn’t receiving any packets. Any ideas on what to do?
Hi Jeremy, do you perhaps have the old set-up from before the security? I’ve had this set-up last august but my installation was nuked after I went to play around. Trying to fix it but I can’t get it back the way it used to be. If I follow the tutorial to the letter then I can’t start the apache server. If I skip the SSL part I get it running but the webpage shows all weird signs. Your previous walk-through was perfect for me. Do you perhaps still have it?
If you skip the security steps, everything is unchanged from before I added those optional things. What is the error you get when the apache server won’t start? What are the “weird signs” you get if you skip the SSL part? If you post your problem as an issue on github, that will also make it easier for me to track and fix – this should certainly work whether or not choose to use SSL. https://github.com/sciguy14/Remote-Wake-Sleep-On-LAN-Server/issues
I’m missing: sudo apt-get install libapache2-mod-php5
Found it just 2 seconds ago on: https://www.raspberrypi.org/forums/viewtopic.php?f=34&t=36777 and it fixed it all.
Thanks for your quick response! I hope this can be added :)
Great! So are you running with or without SSL, now?
I’m currently running without SSL as the former instructions didn’t seem to work properly with my OSMC (Jessie/Debian) release, or perhaps it was due to the php5-thing missing. It seems to do what I need it to do now.
I have edited the index.php to add some links to services running my desktop pc and disabled the sleep mode (set $pinginfo = “”) as I don’t need the sleep mode and it takes a few seconds to ping my PC which returns an active state even when off. Besides I usually access it through teamviewer and then shutdown manually.
Nevertheless your scripting really helps me out for the wake-up part as WOL from outside only works when my PC is off since less than a minute and my router blocks outside-WOL to PC’s out of the ARP. This helps me because my Pi is in my home network.
Thank you very much!
I was thinking of not implementing the ssl as I thought it would keep saying the certificate can’t be trusted (not planning to buy an official one) and I’m using a simple password for turning my dekstop on/off
Also, I added this to the instructions – thank you.
A question regarding sleep on LAN – this works if Windows 10 is fully logged in, for example by using remote desktop or local login, but not if Windows has only reached the login page. Can this be done?
Further to the above I think the problem is that Sleep on LAN needs to be started before the login prompt and starting it as a service might be the way to do this? Anyone tried this?
I haven’t tried it on Windows 10 – I still use Windows 7. Not sure if it handles startup execution differently…
Hi Jeremy. I am using your script for a almost one year now every day and I am very satisfied. Thank you for the great work!
I am using the work before the 9/14/2015 update without https activated. If I don’t want to activate it – is there a need to update? If so, how do I update?
Hi, Could anyone help with the question how to update to the latest version?
read back to https://www.jeremyblum.com/2013/07/14/rpi-wol-server/comment-page-3/#comment-1426893
Hello Jeremy Blum,
firstly my english is not so good, but i try my best.
For a longer Time i installed the Wake on Lan Server on My Raspberry Pi.
Now i will edit something but i cant find the tutorial with the Commands.
Can you help me?
The Only thing i can find is this
I just set this up using Raspbian Jessie and run into a couple of problems. Hopefully this can help someone who is stuck with the same issues…
When I managed to access the webpage, I had some issues with being able to ping (always said the target machine is down). Turns out that ping is an admin only operation from the Ras Pi… Fixed this by doing:
sudo chmod +s /bin/ping
(no idea if this causes other problems, i guess maybe someone could breach the web app and start pinging devices on my lan)
Also, when trying to run the two commands on /etc/apache2/conf.d/security, I was unable to find the path/file. I just ended up leaving these two commands out since I havent got a clue what they were doing. It seems to work though.
Thanks for the tutorial! I hope this will save me a bunch of cash on my electricity bill :)
I’ve been running this without any trouble since about October of 2013 and am trying to set one up for my parents house using a Raspberry Pi Zero.
I was unable to get Raspbian Wheezy to load up on the Zero and ended up having to use Raspbian Jessie (2015-11-21).
Followed the installation instructions on this page, but was unable to ever access the WOL page. Instead, I got to the Apache2 Debian Default Page so I went ahead and deleted the index.html page as someone had suggested, but then I would either get a directory listing or a blank page (I had tried moving files from /var/www to /var/www/html as someone else had posted). So it seemed like I was really close, but couldn’t quite get it up and running.
I’m really not sure if it’s the Jessie or the Pi Zero that’s causing me issues but I love how well this worked for me in the past so I’m sold on it’s effectiveness. Admittedly I’ve got very limited experience with Linux/Pi/etc.
Tried it again from scratch going step by step this time trying to enable SSL. Tried to restart apache2 service and it wouldn’t work. After changing the ssl.conf file to say Mutex sysvsem default I was able to restart apache2. Then I got stuck on the following steps:
15. sudo sed -i.bak “s/ServerSignature On/ServerSignature Off/g” /etc/apache2/conf.d/security
No such file or directory
16. sudo sed -i.bak “s/ServerTokens Full/ServerTokens Prod/g” /etc/apache2/conf.d/security
No such file or directory
Moved on, but still ended up getting the Apache2 Debian Default Page. Stuck for now. :)
1) Name and parent folder have changed from: /etc/apache2/conf.d/security
Edit this file manually: sudo nano /etc/apache2/conf-available/security.conf
2) Move all files and folder “bootstrap” from “/var/www” to “/var/www/html”
sudo chown pi: /var/www/html
3) sudo apt-get install libapache2-mod-php5 (thanks Peter)
I have done this and it works now
Thanks for this tutorial!
since i’m using a vpn to connect to loacl network i don’t need SSL.
Before the SSL part i build a wol pi without any problem but now i needed a second one and the problems start.
After 1 day trying (no Linux guy) i found a few quirks;
– you need the wheezy download from adafruit
After that i folowed the guide to the letter, skipping the ssl part, no luck.
To get apachy (webpage) started i had to remove the SSL part out of etc/apache2/sites-enabled\000-default. That got things started but still no page.
Copied all files from /var/www to /var/www/html and now i got the webpage running but i found out that i should leave the config.php in /var/www
Did not bother to find out which file got the webpage started, it works now.
Please make a good detour in the guid for the non SSL users.
Hope this saves somenone a day work.
i’m installing the wol-server without ssl.
the command sudo service apache2 gives me the following error:
Syntax error on line 5 of /etc/apache2/sites-enabled/000-default:
Invalid command ‘SSLEngine’, perhaps misspelled or defined by a module not included in the server configuration
Action ‘configtest’ failed.
The Apache error log may have more information.
any idea what is going wrong?
I feel like I’m missing something obvious. I’ve got it all up and running but when I enter the password it says it’s invalid. Double checked the hah but it’s not recognizing it. Instead, if I leave the field blank it works. Toss out suggestions?
Did you convert the password to a hash value before entering in the config?
Assuming you did check there isn’t a space or anything else within the quotes on the hash value and that it has a ; at the end.
Thanks for your work on this, and sorry for reviving an old post.
Tool works perfectly for me, I have tried to move the files to a child directory (/var/www/wol) as I want it to be part of a bigger project, but the css styling doesn’t work. Aware of the $BOOTSTRAP_LOCATION_PREFIX = “”; option in the config, but regardless of me leaving that as is (with the bootstrap folders copied in the new child directory) or pointing it to the original /var/www location (where i left the original copy of the files) the css doesn’t apply. This also seems to be true if I rename the original index.php in the original location and point directly to that.
Please ignore above, apparently I’m an idiot!
Works perfectly, thanks for your work, learnt loads.
It works great, if I access the webpage with: “http://192.168.yyy.xx/?computer=0”
I get a blank page, if I access with: “http://192.168.yyy.xx/”
“PHP Warning: Cannot modify header information – headers already sent by (output started at /var/www/html/index.php:21) in /var/www/html/index.php on line 33”
Anyway, a great tutorial. Many thanks!!
Hi; I downloaded it and it’s an awesome app! One question though: I have a bad wireless card for WOL so my computer keeps waking up; if I connect the two via an ethernet cable using the 10.100.x.x ip range but use the wifi for global network with the 192.168.x.x ip range, will I be able to visit it from 192.168.x.x and make it ping from 10.100.x.x to 10.100.x.y?
I have done everything as it says in tutorial but still got the empty webpage… All files are allready in /var/www/html… No luck with or without SSL…
Start with parameter e.g.: http://10.0.0.15/?computer=0