Apache running on Apple TV

by editor @ AppleTVHacks.net on March 25, 2007


Thanks again to Jonathan for writing up the process. Here it is…

To get Apache running on your Apple TV, firstly enable SSH so you can access the box easier.

From there, you can scp the directory /usr/libexec/httpd/ from your Mac to the Apple TV:

scp -r /usr/libexec/httpd frontrow@your.apple.tv.ip.address:/usr/libexec/.

Then ssh into the Apple TV and run:

sudo /usr/sbin/apachectl start

Pow. Apache is running. You can now access the Apple TV from a web browser, in either fashion:

http://your.apple.tv.ip

http://yourappletvname.local

The default httpd.conf file uses the /Library/WebServer/Documents/ directory for its DocumentRoot and also enables the user-level Sites folder, so this also works:

http://your.apple.tv.ip/~frontrow

http://yourappletvname.local/~frontrow

apache on apple tv Apache running on Apple TV
personal web sharing on apple tv Apache running on Apple TV

Now, we are interested in whether that opens up the door to make a browser based administration system for the Apple TV. Combined with SFTP/AFP for files access, we believe an alternative system to iTunes could be built for managing the content on your Apple TV.

Whatever you do with this; let us know how you get on!

  • Jonathan

    Alternatively to copying the libexec/httpd directory, you could probably cripple your Apple TV’s Apache by commenting out the DSO LoadModule lines from /etc/httpd/httpd.conf. But then you wouldn’t have CGI, PHP, Bonjour, etc. in Apache, though I imagine it would start.

  • iu

    what about webmin?

  • http://zuble.blogspot.com Wing

    Even better might be to install MAMP, that way you have Apache/PHP/MySQL running which could allow for more flexibility in coding a new interface to add and remove media to the AppleTV.

  • http://freetube.us.tc live tv online

    hmm but can you actually run it as a webserver?

  • jgalt

    Um, why would you want to run apache on AppleTV?

  • http://dockingbay94.net Paul Rodriguez

    Using this technique, I get:

    -bash-2.05b$ sudo /usr/sbin/apachectl start
    Syntax error on line 207 of /etc/httpd/httpd.conf:
    Cannot load /usr/libexec/httpd/mod_log_config.so into server: (reason unknown)
    /usr/sbin/apachectl start: httpd could not be started

    the httpd directory doesn’t need to come from an intel box, does it?

  • http://dockingbay94.net Paul Rodriguez

    none of the files i copied are seen, as i tried commenting several out. any ideas? i copied from a PowerPC machine.

  • George

    Wiimote!

    Really, get a wiimote running with it, the drivers are already out there.. that’ll be the bomb, remote desktop, browser, and wiimote across the room.. lovely jublly..

  • p*

    if MAMP can run on AppleTV would be VERY NICE!!

  • bizzy

    running apachectl start will not enable httpd on subsequent reboots.

    setting “WEBSERVER:=-YES-” in /etc/hostconfig will.

    If you change the setting in hostconfig, starting via “/System/Library/StartupItems/Apache/Apache start” will also work.

  • LDJ

    Hello,

    I like the idea of a sub-$500 headless computer to be a webserver/media server.

    —-Quote—-
    Soward

    Oh, and I’m sure others have tried it, but plugging in a USB keyboard and then holding down Apple-V shows you the normal verbose boot, and Apple-S does boot to a single-user root prompt (or it did for me on my already modified atv), but then there’s no HID driver loaded so you can’t type anything….
    —-Quote—-

    So, it is not like the USB is disabled, but just needs the correct drivers? Could not these drivers be taken from an Intel Mac and ported over to the AppleTV? And if you can move the HID driver, why not a flash/HDD driver, so that then you can just add space via an external drive?

    I mean, I assume that if you can run SSH, then you could set up an alias that points to the external drive…

    Or am I over simplifying things?

    LDJ

  • htg

    “none of the files i copied are seen, as i tried commenting several out. any ideas? i copied from a PowerPC machine.”

    Paul, the Apple TV utilises an Intel x86 CPU.

    What makes you think that PowerPC compiled Mac OS X BSD userland applications and libraries would have a chance in hell of working?

    It is only the desktop Mac OS X applications, built using X Code, that use fat binaries, that can include both PowerPC and x86 code, as far as I am aware.

    Find a mate with an Intel based Mac and get him to bring it around yours for an AppleTV hacking session in a few weeks when all the major hacks have been done and automated :)

  • Pingback: Hacking The AppleTV « Cory Bohon()

  • http://www.DemSign.com DemSign

    Okay, what I’m waiting to see is if someone puts a hard drive with a full Intel install of Tiger on it if the Apple TV can be used as a mini Mini.

  • http://www.eduo.info Eduo

    LDJ: You may want to take a look at the DiskStatioons from Synology, as that’s what they are.

    I wouldn’t mind, either, having a box that can handle being a fileserver, a webserver and a torrent client (which is what my Synology DS 106-J currently does, but it’s so ugly) which can also connect to a TV and play the media.

    Admittedly, I don’t know the CPU limits of the AppleTV. It may be just too much.

  • colo

    Next thing you know, we’ll have AppleTV colocation services just as the do with the Mac Mini!

  • http://dockingbay94.net Paul Rodriguez

    yeah i thought the only binary was the httpd, but i guess those other files are compiled too, eh? on first glance they just looked like shell scripts… i guess i proved my ignorance of how apache works lol. thanks for the reply.

  • http://web.mac.com/darkgan76 Ganesan

    Hi guys,

    I was wondering if the following is possible. Suppose I have an external harddisk plugged into Apple’s new Airport Extreme base-station (i.e. I have an NAS). And I have just managed to SSH into AppleTV (following appletvhacks.net instructions). Then would it be possible for me to run iTunes on AppleTV and point it to an iTunes Library on the NAS? This way I dun have to have a computer running iTunes everytime I want to watch something (assuming I have yet to sync anything to AppleTV).

    cheers,
    Ganesan

  • chasd

    I’d like to see someone try the WebDAV suggestion I left on the awkwardTV Wiki. I don’t currently have a AppleTV to try it myself. The URL is

  • Pingback: Cheapest Mac ever, or April Fools? - hedgy.com()

  • eaghra

    MAMP does indeed work. Just got it going on my appletv with php5/mysql5, and even imagemagick, serving up multiple virtual hosts.

  • Pingback: Hacking the Apple TV at heavenlytree()

  • Pingback: VOIPBLOG.IT » AppleTV hacks e… come trasformare una Xbox in una AppleTV()

  • Pingback: Run a web server on an Apple TV « stevecclifford.co.uk/blogâ„¢()

  • Pingback: Apple Tek » Blog Archive » Hackers Dissect Apple TV to Create the Cheapest Mac Ever()

  • Pingback: Live and Beyond » Blog Archive » Apple TV hacks - Void your warrenty in Style()

  • Pingback: TechTear :: T_T » Apple TV: una navaja suiza()

  • Steve

    These Hacks are Great!! They are simple to do and work GREAT!! However, it would be very usefull to see somebody submit details about how to enable PHP and or mySQL. Sure, I know know how to copy /usr/bin/php, but does apache mods need to be coppied? What needs to be done in httpd.conf? Thanks for all of the useful tips.

  • GoldstarQC

    Hi, I just wrote a mini Howto for adding XAMMP to the Apple TV. Look for it at awkwardtv.org (on the wiki). This will enable Apache/MySQL/PHP/Perl/ProFTPD.

    Hope this help,

    GoldstarQC

  • Pingback: Hazme el Chingado Favor » Haz de tu Apple TV una Mac()

  • http://www.compredia.de Christian

    We replaced a small production Webserver with an Apple tv since May 6th 2007.

    Works pretty good!

    The Apple TV only runs the Apache Webserver, cause it definitely has not enough ram to handle the large MySql Database.

    Here you can see the result: http://www.compredia.de

  • Pingback: Compredia.de jetzt auf Apple TV gehostet | Christian Engelke()

  • Pingback: » Apple TV = hacked | The Apple Core | ZDNet.com()

  • Pingback: apple » Blog Archive » Apple TV hacks coming fast and furious: VLC, SSH, VNC, Apache and more()

  • big fred

    This sounds great – unfortunately when I try the command;

    scp -r /usr/libexec/httpd frontrow@your.apple.tv.ip.address:/usr/libexec/.

    I get the error;
    scp: /usr/libexec/./httpd: Permission denied

    I’m definately logged in to the apple tv… – do I need to alter permissions or use a sudo command?

    any help gratefully received

  • Marco

    is there any way to make “VPN Server running on Apple TV” possible?

    please let me know how.

  • Companymarco

    Yes just go to unblock-us and it is done $5 a month

Previous post:

Next post: