Installing: Serving files via x-send-file

By Default Webiva sends private files directly via rails - As apache is a lot better at serving files than Rails installing the x-send-file apache will help you Webiva performance (and memory usage). * * *


    Prerequisites

    If you installed Webiva directly from our Installation Documentation then you’re using Apache and Passenger. This tutorial is written with the assumption that you are and the hope that if you’re slick enough to set up Webiva in your own non-apache/passenger way then you’re slick enough to take what you need from this and fit it to suit you.

    apxs2 is not installed on Ubuntu with the apache2-server. Its located in the development packages. You can find it by:

    apt-cache search apxs2  

    Currently the containing packages are named

    apache2-prefork-dev - Apache development headers - non-threaded MPM
    apache2-threaded-dev - Apache development headers - threaded MPM  

    This should give you a list of all packages which contain the file. They will be apache packages, but are not pertinent to the running of Webiva so the choice in what to install is yours.

    Installing

    We need to download, compile and install the xsendfile module, let’s to that:

      $ mkdir xsendfile
      $ cd xsendfile/
      $ wget http://tn123.ath.cx/mod_xsendfile/mod_xsendfile.c
      $ sudo apxs2 -cia -n xsendfile mod_xsendfile.c

    If XSend file isn’t installed automatically, you can add it in manually:

      $ sudo vi /etc/apache2/mods-available/xsendfile.load
    
      Add the following line:
              LoadModule xsendfile_module /usr/lib/apache2/modules/mod_xsendfile.so
    
      $ a2enmod xsendfile
      $ apache2ctl -t

    Now any Webiva virtual hosts should have the following lines added in:

      XSendFile on
      XSendFilePath /home/webiva

    (XSendFilePath should be set to your base webiva directory)

    Now restart apache

      $ apache2ctl restart

    Now edit the config/defaults.yml file and add the following in:

      use_x_send_file: true

    Restart Webiva and you should be good