Turn an Apple TV 2 into a Web Server
So you already setup your Apple TV2 to run XBMC, and now you’re bored with it. Why not turn the ATV2 into a webserver like the guys at MacMiniVault did? Yes this link opens a web page served from an Apple TV2. You can do this yourself with your own Apple TV without too much work, just a bit of patience.
Before getting started, you’ll need to jailbreak the Apple TV2 with Seas0nPass, Seas0nPass is the easiest jailbreak utility around, but you could use PwnageTool or Redsn0w if that floats your boat. After you’ve done this, here’s a rundown of what you’ll need to do:
- SSH into the newly jailbroken Apple TV2 from the Terminal, the default root password is ‘alpine’ and you’ll need to know the AppleTV2’s IP address or you can try using the hostname apple-tv.local:
- Change the root password from alpine to something else by typing ‘passwd’
- Install Lighttpd onto the Apple TV2 by using apt-get:
- Use your favorite SFTP app (CyberDuck is free) to upload a lighttpd config file to /etc/lighttpd.conf – here’s a sample lighttpd.conf to work from
- Now launch lighttpd server with (you may need to run this as /usr/sbin/lighttpd-angel):
ssh root@apple-tv.local
apt-get install lighttpd
lighttpd-angel -f /etc/lighttpd.conf
Your Apple TV2 web server should now be up and running, this can be verified by pulling up the ATV’s IP address in a web browser.
If you want the webserver to automatically start when the Apple TV boots or reboots, you’ll need to add a launch agent plist to /Library/LaunchDaemons/, plist files are different than bash scripts in that you have to spell out each individual flag and argument as a string. In this case, the command to execute lighttpd-angel would translate to plist keys looking something like this:
This walkthrough isn’t perfect yet, it’s an elaborated version from the super simplified instructions on MacMiniVault who setup this live Apple TV webserver just to see how well it will handle the traffic load.
Any way you know of to get PHP and MySQL running on there as well? That would rule.
One would expect:
apt-get php
apt-get mysql
Or something along those lines :)
Another option is to install the yaSSL Embedded Web Server on your Apple TV. Process is explained here: http://bit.ly/oqmu8V.
[…] Turn an Apple TV 2 into a Web Server – Bored with your Apple TV 2 just being a media player? Did you already jailbreak, install XBMC, and turn the ATV2 into a media center? Go a step further and turn the Apple TV2 into a full blown web server, because you can. […]
If you aren’t going to use the aTV as an actual TV display device, you can disable the “AppleTV” service and save 25% CPU instantly. The “AppleTV” service is not required to be running for the machine to function… it is only required to launch frappliances (XBMC, NitoTV, etc…) and provide the GUI interface, which is unnecessary for a webserver.
To do this, do ‘chmod -x /Applications/AppleTV.app/AppleTV’ followed by a ‘killall AppleTV’
You should be good to go!
[…] Wer das Ganze selbst mal ausprobieren möchte, findet bei OSXDaily eine ausführliche Installationsanleitung. […]
Really a great idea and a much better tutorial than on the mac mini vault page. Unfortunately in the last step I get an error: After typing lighttpd-angel -f /etc/lighttpd.conf I get this error (even if in the directory /usr/sbin): “can’t find username lighttpd”.
I’m a total newbie, perhaps someone can help me.
hi there,
just put a # in front of username in the lighttpd.conf!
did you get this to work? I’m giving this a shot, also, but i’ve found myself stuck in the same spot.
thanks for the time. good luck with your stuff.
[…] tweeted and blogged about this project. A special thanks goes out to macstories.net, cultofmac.com, osxdaily.com, and […]
New weekend project… there goes $99!