It's better when it's simple

User Tools

Site Tools


Configuration Setting: xsendfile

In DokuWiki all media files (e.g. images) are delivered using a PHP script to check access restrictions and in the case of images, resize them. This requires more resources than delivering them by the webserver alone. Several webservers make it possible to take over delivery from a script once it has done its checks. This is done by sending a certain HTTP header. The header itself is dependent on the particular webserver.

This option enables sending of this header. Note: if you enable the wrong option here, your images and downloads may no longer work.

  • Type: Number
  • Default: 0

The following options are available:

Value Result
0 No header is sent, all data is delivered by DokuWiki
1 A proprietary lighttpd header is used (for lighttpd < 1.5)
2 A standard X-Sendfile header is used
3 A proprietary Nginx header is used

For X-SendFile support in Apache you need mod_xsendfile. Then add the XSendFile on and the XSendFilePath PATH directive to (for example) your VirtualHost configuration. The PATH for XSendFilePath should be the path to the data directory of your DokuWiki installation.

Accelerated downloads in nginx are only possible with URIs. Configure a location for your data directory relative to the wiki root.

location ~ ^/dokuwiki/data/ {
    root /public;

The internal option protects the path from being accessed remotely. If the data directory is not a subdirectory of the web root, you can use an alias instead.

location ~ ^/dokuwiki/.*\.php {
    root /public;
    # FastCGI options...
location ~ ^/dokuwiki/data/ {
    alias /private/data/; # note the trailing slash

Warning: Changing this option could cause unintended behaviour.

See also

config/xsendfile.txt · Last modified: 2015-05-06 06:51 by PatrickBrown

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki