Install (and enable) XSendFile in Azure App Service (Linux/Apache)

I’m trying to install and enable the XSendFile Apache module in a Linux (Debian) Azure App Service, but although it seems the module is installed and enabled, I get the following error when adding “XSendFile On” to the .htaccess file:

Invalid command ‘XSendFile’, perhaps misspelled or defined by a module not included in the server configuration

This is all I have done, step by step:

  1. downloaded mod_xsendfile.c file from https://tn123.org/mod_xsendfile/
  2. uploaded it to my Azure App Service folder (wwwroot)
  3. Using SSH (from my wwwroot folder): apxs2 -cia mod_xsendfile.c
  4. After install, I get a “Libraries have been installed in: /usr/lib/apache2/modules” and “Enabling module xsendfile.

Then, I check if the module is enabled with “apache2ctl -t -D DUMP_MODULES

And it seems it is enabled. I get a list of enabled modules. Last one says “xsendfile_module (shared)”

I then add this line to my .htaccess file:

 XSendFile On

But I get an Internal Server Error trying to open any page.

I also tried to add this to my httpd.conf file, with same result:

 LoadModule xsendfile_module /usr/lib/apache2/modules/mod_xsendfile.so

Of course if I comment the “XSendFile On” line, web shows correctly.

The error in the LOG is this:

/home/site/wwwroot/.htaccess: Invalid command ‘xsendfile’, perhaps misspelled or defined by a module not included in the server configuration

Apache version is 2.4. I have tried to install X-Sendfile via YUM, etc. with no success.

Also, getting loaded apache modules with PHP “apache_get_modules()” doesn’t show the Xsendfile module!

What am I doing wrong?