Recently someone told me about the X-Sendfile support that was added to Moodle in version 2.3 and I just wanted to publicise the feature to let others know about it.
I don’t believe that it’s currently well documented which is a shame, and something I’d like to improve when I have a few minutes. The current documentation that I’ve come across is all in config-dist.php (search for X-Sendfile).
The idea of the feature is to get the web server to serve files from moodledata rather than having it done using PHP. On the whole, this is a good thing for a number of reasons:
* php isn’t particularly efficient at serving files in this way (byte-serving) – it doesn’t cache files for starters (though your kernel should of course);
* while php is serving a file, it’s unlikely to fork in an effective manner so you’re also locking processes which could otherwise serve your users;
* your web server’s primary aim is to serve files – it’s designed for this and it is designed to do so in an extremely efficient manner. It’s also likely to handle caching much more efficiently.
ב-Moodle in English: Using X-Sendfile to serve files in Moodle.