XSendFile and Hosting Wordpress on a Mac Server

As well as make apps we also work at a innovative school in Papamoa, New Zealand. This blog sometimes contains the technical details that might be useful to colleages in similar schools, or just so we don't forget when things go wrong. Most of you will find this boring and useless, but one or two people might find it useful!

We use Easy Blog Jr. to help our kids blog on their wordpress blogs, which we self-host on a Mac Server. It makes really great narrated blog posts, but we had a bit of trouble when we tried to view the video posts on the iPad. Instead of showing a play button, iOS showed a crossed out play button with a spinning swarm of circles. We contacted the developer, who said it was a known issue on the Server's side - giving us instructions on how to fix it.

Unfortunately because we're stubborn and use a Mac Server, these instructions didn't work but they did point us in the right direction.

Here's what you need to do:

  • Download ModXSendFile.
  • Compile and Install it (you'll need XCode and XCode Command Line Tools installed first) using the command: apxs -cia -Wc,"-arch i386 -arch x86_64" -Wl,"-arch i386 -arch x86_64" mod_xsendfile.c
  • Modify your Wordpress wp-config.php file and add the line: define('WPMU_SENDFILE', true);
  • Modify the appropriate httpd files for your Wordpress installation, stored in /Library/Server/Web/Config/apache2/sites (ours were called 0000_any_-80_blogs.takp.school.nz.conf and 0000_any_443_blogs.takp.school.nz.conf) and add the following lines in the <Directory> section: XSendFile On and XSendFilePath (PATH TO YOUR WEB SERVER - e.g. XSendFilePath /Volumes/Files/Web.
  • Type sudo apachectl restart to restart your apache server.

Reload your blog on an iPad to check and you'll be away! Thanks to the nice developers of Easy Blog Jr. for setting us on the right path.

Update: If you're having trouble along the way I found this gist really helpful.