Apache +挂载文件夹中的文件=损坏的文件

问题描述

我们将LAMP Ubuntu 16.04(Apache 2.4.7)迁移到了具有Ubuntu 20.04(Apache 2.4.41)的新版本。

两者都在/ var / www / intranet / onyar上安装了驱动器。

使用新的驱动器时,如果我从此装入的驱动器下载文件,则该文件已损坏。与旧的一起工作。如果我使用旧服务器下载就可以了。如果我通过samba可以访问。

  • http://newserver/intranet/onyar/test.xls =>已损坏
  • http://oldserver/intranet/onyar/test.xls =>确定
  • \\ newserver \ root \ var \ www \ intranet \ onyar \ test.xls =>确定

那么在Apache和挂载的驱动器之间似乎有问题吗?如果我尝试使用外部安装的驱动器(http://newserver/intranet/test.xls)以外的文件进行操作,则效果很好。

我用txt,办公室类型和PDF文件进行了测试,都损坏了。 HTML文件有效!

我在其中放置了一个简单的'test.txt'文件,其中包含字符串'hola',然后使用'http://newserver/intranet/onyar/test.txt'打开该文件,浏览器向我提供了此信息:

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

实际上,如果我按Ctrl + F5,hola(d_ip = ...)之后的字符串有时会更改:

Last-Modified: 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,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

这些结尾似乎来自其他文件!像Apache一样,不知道文件何时结束,并在其中放置其他内容...

参考:

  • fstab:// onyar / dades / var / www / intranet / onyar cifs凭据= / root / .smb凭据,file_mode = 0775,dir_mode = 0775,自动0 0

解决方法

似乎我受此错误影响:https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=900821

对我来说,解决方案是将其放入/etc/apache2/apache2.conf:

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

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...