My directory /var/www/html/
(which contains files that can be downloaded) contains a soft link to a directory contained on CIFS mounted file system (/mnt/netappIllumina/
).
When files are downloaded from this directory, they are corrupted as a header is added to it (see below).
15:22:10 GMT
ETag: "1d-5af1f5d7cb0cc"
Accept-Ranges: bytes
Content-Length: 29
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
I really don’t have any idea of what is happening there and how to suppress it. Hereafter, some possibly interesting lines of my apache.conf
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
EnableSendfile Off
</Directory>
I accept any advice… I am completely lost. I found a recent similar issue in there but nobody found any solution.
Running :
Server version: Apache/2.4.29 (Ubuntu)
Server built: 2020-08-12T21:33:25
3
Answers
I just solved this same issue on a raspi which had a failed SD card and the new install yielded the exact same problem.
Its taken a bit of searching but
https://superuser.com/questions/1483696/cifs-mounted-on-linux-from-windows-shows-corrupt-distorted-images
suggests adding
EnableMMAP Off
to some file I couldn’t find. I created a .htaccess file in my /var/www/html folder (I actually created that a couple of days ago for another reason), added the EnableMMAP Off line to that and suddenly everything works. No more headers visible in any file type, not .txt, not .conf, .jpg displays an image, .mp4 streams a video. Perfect 🙂
I felt compelled to add my $.02 since you solved around a day’s worth of headache.
adding
to my Ubuntu server’s /etc/apache2/apache2.conf <Directory> directives fixed a very similar issue to OP’s. I would’ve added a comment to the original answer but <50 rep :shrug:
I was unable to load gifs on my Ubuntu web server that were stored on a separate cifs-mounted Windows host. Adding this Apache2 option in the main conf solved this, about a day’s worth of research later.
Fixed the issue for me, I was using an Apache2 docker container to access a samba drive. The container was accessing files just fine, but the web server was not.