Parallels虚拟服务器是CentOS 5.5,主机系统是OSX Snow Leopard
在 CentOS 中,主机文件系统被挂载:
none /media/psf prl_fs sync,nosuid,nodev,noatime,share 0 0
Apache 在 CentOS 中运行,并具有指向主机文件系统的以下别名
Alias /ca_media /home/django/soft-link-via-media-psf/media
<Location "/ca_media">
SetHandler None
ExpiresActive on
ExpiresDefault "access plus 1 week"
FileETag MTime Size
</Location>
这时就变得很奇怪了,下面是主机的演示。似乎有些文件无法被提供 - 但其他文件可以。我看不出两者有什么区别(请注意,“pgevr”是我在 中配置的 CentOS 机器的名称/etc/hosts
):
~/Projects/er_trunk/media/er/js$ ls -l navagation_menu.js
-rw-r--r-- 1 millere staff 702 Sep 21 2009 navagation_menu.js
~/Projects/er_trunk/media/er/js$ curl http://pgevr/ca_media/er/js/navagation_menu.js
curl: (18) transfer closed with 702 bytes remaining to read
~/Projects/er_trunk/media/er/js$ echo 'foo' > bar.js
~/Projects/er_trunk/media/er/js$ curl http://pgevr/ca_media/er/js/bar.js
foo
~/Projects/er_trunk/media/er/js$ ls -l bar.js
-rw-r--r-- 1 millere staff 4 Oct 21 11:51 bar.js
~/Projects/er_trunk/media/er/js$ file navagation_menu.js
navagation_menu.js: ASCII text
~/Projects/er_trunk/media/er/js$ file bar.js
bar.js: ASCII text
~/Projects/er_trunk/media/er/js$ cp navagation_menu.js bar.js
~/Projects/er_trunk/media/er/js$ curl http://pgevr/ca_media/er/js/bar.js
curl: (18) transfer closed with 702 bytes remaining to read
这是与两个文件系统有关的问题,还是与挂载的文件系统类型有关的问题?您将如何调查此问题?
[编辑..这是使用--trace-ascii的失败的curl请求的结果]
~/Projects/er_trunk/media/er/js$ curl --trace-ascii - http://pgevr/ca_media/er/js/navagation_menu.js
== Info: About to connect() to pgevr port 80 (#0)
== Info: Trying 10.211.55.9... == Info: connected
== Info: Connected to pgevr (10.211.55.9) port 80 (#0)
=> Send header, 154 bytes (0x9a)
0000: GET /ca_media/er/js/navagation_menu.js HTTP/1.1
0031: User-Agent: curl/7.19.6 (i386-apple-darwin10.0.0) libcurl/7.19.6
0071: zlib/1.2.3
007e: Host: pgevr
008b: Accept: */*
0098:
<= Recv header, 17 bytes (0x11)
0000: HTTP/1.1 200 OK
<= Recv header, 37 bytes (0x25)
0000: Date: Fri, 22 Oct 2010 16:51:19 GMT
<= Recv header, 31 bytes (0x1f)
0000: Server: Apache/2.2.3 (CentOS)
<= Recv header, 46 bytes (0x2e)
0000: Last-Modified: Thu, 21 Oct 2010 21:55:19 GMT
<= Recv header, 27 bytes (0x1b)
0000: ETag: "2be-4932794f5ffc0"
<= Recv header, 22 bytes (0x16)
0000: Accept-Ranges: bytes
<= Recv header, 21 bytes (0x15)
0000: Content-Length: 702
<= Recv header, 31 bytes (0x1f)
0000: Cache-Control: max-age=604800
<= Recv header, 40 bytes (0x28)
0000: Expires: Fri, 29 Oct 2010 16:51:19 GMT
<= Recv header, 19 bytes (0x13)
0000: Connection: close
<= Recv header, 40 bytes (0x28)
0000: Content-Type: application/x-javascript
<= Recv header, 2 bytes (0x2)
0000:
<= Recv data, 0 bytes (0x0)
== Info: transfer closed with 702 bytes remaining to read
== Info: Closing connection #0
curl: (18) transfer closed with 702 bytes remaining to read
答案1
我遇到了同样的问题,并且取消注释 /etc/httpd/conf/httpd.conf 中的 EnableSendfile Off 对我有用(如 Deutch 在上面的帖子中所建议的那样)。