0

We migrated our LAMP Ubuntu 16.04 (Apache 2.4.7) to a new one with Ubuntu 20.04 (Apache 2.4.41).

Both with a drive mounted on /var/www/intranet/onyar.

With the new one, if I download a file from this mounted drive it's corrupted. With the old one it works. If I download with the old server it's ok. If I access via samba it's ok.

  • http://newserver/intranet/onyar/test.xls => CORRUPTED
  • http://oldserver/intranet/onyar/test.xls => OK
  • \\newserver\root\var\www\intranet\onyar\test.xls => OK

So it seems a problem between Apache and mounted drive? If I try it with a file outside mounted drive (http://newserver/intranet/test.xls) it works OK.

I tested it with txt, office type and PDF files, all corrupted. HTML files works!

I put a simple 'test.txt' file with the string 'hola' inside and I open it with 'http://newserver/intranet/onyar/test.txt' the browser give me this:

Last-Modified: Thu, 12 Nov 2020 09:38:46 GMT
ETag: "4-5b3e5adb1be88"
Accept-Ranges: bytes
Content-Length: 4
Cache-Control: max-age=1209600
Expires: Thu, 26 Nov 2020 09:40:37 GMT
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/plain

holad_ip = dnsResolve(host);
    if (isInNet(resolved_ip, "127.0.0.1", "255.255.255.255") || isInNet(resolved_ip, "172.16.0

In fact, if i Ctrl+F5 the string after hola (d_ip = ...) changes sometimes:

Last-Modified: Thu, 12 Nov 2020 09:38:46 GMT
ETag: "4-5b3e5adb1be88"
Accept-Ranges: bytes
Content-Length: 4
Cache-Control: max-age=1209600
Expires: Thu, 26 Nov 2020 09:57:01 GMT
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/plain

holar.</p>
<hr>
<address>Apache/2.4.41 (Ubuntu) Server at 10.80.160.178 Port 80</address>
</body></html>
p>The document h
Last-Modified: Thu, 12 Nov 2020 09:38:46 GMT
ETag: "4-5b3e5adb1be88"
Accept-Ranges: bytes
Content-Length: 4
Cache-Control: max-age=1209600
Expires: Thu, 26 Nov 2020 09:57:01 GMT
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/plain

holaIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>302 Found</title>
</head><body>
<h1>Found</h1>
<p>The document ha

These endings seems to be from other files! Like Apache don't know when is the file ending and puts there some other stuff...

Reference:

  • fstab: //onyar/dades /var/www/intranet/onyar cifs credentials=/root/.smbcredentials,file_mode=0775,dir_mode=0775,auto 0 0

1 Answer 1

1

It seems that I'm affected by this bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=900821

For me the solution is putting this in /etc/apache2/apache2.conf:

<Directory "/var/www/intranet/onyar">
  EnableMMAP Off
</Directory>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.