Archive
This post is archived and may contain outdated information. It has been set to 'noindex' and should stop showing up in search results.
How to Install XSendFile (mod_xsendfile) Onto Your Apache VPS Web Host
Nov 17, 2015Web DevelopmentComments (0)
Here is a guide on how to install XSendFile onto your VPS web host. This does require that you have root access and can run commands over SSH.

Step 1
Download mod_xsendfile.c from the official XSendFile page. Using FTP or another method, upload mod_xsendfile.c onto your server. I uploaded it into my home directory. Once you're done with step 2, you can delete this file, so its location isn't important.

Step 2
Using SSH, make sure you are in the folder containing mod_xsendfile.c and run this command:

apxs -cia mod_xsendfile.c
This causes Apache to build and install the XSendFile extension. The -cia option tells Apache that it should compile (c), install (i), and activate (a) the module.

Step 3
Restart Apache and XSendFile will be ready to start processing X-SENDFILE headers. You'll need to put XSendFile on in your .htaccess files or in your httpd.conf for XSendFile to work.

Step 4
If you are looking to serve files that are above your document root or above the location of the file generating the X-SENDFILE header in the file system heirarchy, you'll need to configure the XSendFilePath option in your Apache config.

This option can only go in your httpd.conf and will not work in .htaccess files. Put this option in with the location of your files you want to serve:

XSendFilePath "/home/EXAMPLE_WEB_LOCATION/"
This will allow XSendFile to serve files located there and below. This is a security feature to prevent XSendFile from being able to serve files anywhere on the system by default.
Comments (0)
Add a Comment
No comments yet