我试图在运行Apache 2.2.17的Windows 2008 Server上将MoinMoin设置为办公室维基。 原本我以为一切工作正常,除了某些原因的图像不能正常显示。 事实certificate,我所有的静态服务的内容被截断(多达800个字符),我试图找出原因。
错误日志不显示任何内容,并且访问日志表示文件被传送200 OK或304 Unchanged。
所有的dynamic内容似乎显示确定和未截断,我有一个Django的安装在同一台服务器上也正常工作。
什么可能导致这种奇怪的行为? 一个奇怪的math,我认为指向一个编码问题 – 对于所有的文本文件,丢失的字符数等于截断版本文件中换行符的数量。 改变文件本身的编码似乎没有帮助,但是如果我把所有的内容放到一行上,就好了。 虽然这似乎确实解决了这个问题,改变所有的文件将是有点笨重,我不能猜测如何用图像做到这一点。
附录 :这是我使用Wireshark的TCPstreamfunction在客户端上看到的。 我注意到的主要事情是dynamic内容(/ bgcwiki)有一些换行符后跟0,而静态内容并不总是甚至有一个换行符。 尤其是,.png的内容末尾和下一个GET请求之间没有空格。
GET /bgcwiki HTTP/1.1 Host: msdc2 Connection: keep-alive Cache-Control: no-cache Pragma: no-cache User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.63 Safari/535.7 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Encoding: gzip,deflate,sdch Accept-Language: en-GB,en-US;q=0.8,en;q=0.6 Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3 Cookie: sessionid=6e2eaf00d5f8f22b576ed232d4f2fafb; csrftoken=8eb6a8ed71814c2c037532ed51cc2f81; MOIN_SESSION_80_ROOT_bgcwiki=95631c8ede11697138a37901afe53fc38b412812 HTTP/1.1 404 NOT FOUND Date: Thu, 12 Jan 2012 15:04:39 GMT Server: Apache Vary: Cookie,User-Agent,Accept-Language Set-Cookie: MOIN_SESSION_80_ROOT_bgcwiki=95631c8ede11697138a37901afe53fc38b412812; expires=Sun, 09-Jan-2022 15:04:00 GMT; Max-Age=315360000; Path=/ Keep-Alive: timeout=5, max=99 Connection: Keep-Alive Transfer-Encoding: chunked Content-Type: text/html; charset=utf-8 1386 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"> <meta name="edit_on_doubleclick" content="/bgcwiki"> <meta name="robots" content="index,nofollow"> <title>bgcwiki - Boys & Girls Club of Thunder Bay</title> <script type="text/javascript" src="/bgcwiki/moin_static193/common/js/common.js"></script> <!-- snip --> 14 </body> </html> 0 GET /bgcwiki/moin_static193/common/js/common.js HTTP/1.1 Host: msdc2 Connection: keep-alive Cache-Control: no-cache Pragma: no-cache User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.63 Safari/535.7 Accept: */* Referer: http://msdc2/bgcwiki Accept-Encoding: gzip,deflate,sdch Accept-Language: en-GB,en-US;q=0.8,en;q=0.6 Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3 Cookie: sessionid=6e2eaf00d5f8f22b576ed232d4f2fafb; csrftoken=8eb6a8ed71814c2c037532ed51cc2f81; MOIN_SESSION_80_ROOT_bgcwiki=95631c8ede11697138a37901afe53fc38b412812 HTTP/1.1 200 OK Date: Thu, 12 Jan 2012 15:04:40 GMT Server: Apache Etag: "wzsdm-1326330976-29032-305726357" Cache-Control: max-age=43200, public Expires: Fri, 13 Jan 2012 03:04:40 GMT Content-Length: 29032 Last-Modified: Wed, 11 Jan 2012 20:16:16 GMT Keep-Alive: timeout=5, max=98 Connection: Keep-Alive Content-Type: application/x-javascript // // MoinMoin commonly used JavaScript functions // /* snip */ runASAP(runScrollTextareaInitOnce); // ensure init will be run by obsolete browsers addLoadEvent(runScrollTextareaInitOnce); GET /bgcwiki/moin_static193/smallbgclogo.png HTTP/1.1 Host: msdc2 Connection: keep-alive Cache-Control: no-cache Pragma: no-cache User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.63 Safari/535.7 Accept: */* Referer: http://msdc2/bgcwiki Accept-Encoding: gzip,deflate,sdch Accept-Language: en-GB,en-US;q=0.8,en;q=0.6 Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3 Cookie: sessionid=6e2eaf00d5f8f22b576ed232d4f2fafb; csrftoken=8eb6a8ed71814c2c037532ed51cc2f81; MOIN_SESSION_80_ROOT_bgcwiki=95631c8ede11697138a37901afe53fc38b412812 HTTP/1.1 200 OK Date: Thu, 12 Jan 2012 15:04:40 GMT Server: Apache Etag: "wzsdm-1326230173-7814-930940522" Cache-Control: max-age=43200, public Expires: Fri, 13 Jan 2012 03:04:40 GMT Content-Length: 7814 Last-Modified: Tue, 10 Jan 2012 16:16:13 GMT Keep-Alive: timeout=5, max=97 Connection: Keep-Alive Content-Type: image/png .PNG ... IHDR.......Z.............sRGB.........bKGD..............pHYs.................tIME... .. /* snip */ ...(Fg.1......(F1.Qb...(F1.Qb......P.Yg[XB.....IEND.B`.GET /bgcwiki/moin_static193/modern/css/print.css HTTP/1.1 Host: msdc2 Connection: keep-alive Cache-Control: no-cache Pragma: no-cache User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.63 Safari/535.7 Accept: text/css,*/*;q=0.1 Referer: http://msdc2/bgcwiki Accept-Encoding: gzip,deflate,sdch Accept-Language: en-GB,en-US;q=0.8,en;q=0.6 Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3 Cookie: sessionid=6e2eaf00d5f8f22b576ed232d4f2fafb; csrftoken=8eb6a8ed71814c2c037532ed51cc2f81; MOIN_SESSION_80_ROOT_bgcwiki=95631c8ede11697138a37901afe53fc38b412812 HTTP/1.1 200 OK Date: Thu, 12 Jan 2012 15:04:41 GMT Server: Apache Etag: "wzsdm-1277603206-811-309986213" Cache-Control: max-age=43200, public Expires: Fri, 13 Jan 2012 03:04:41 GMT Content-Length: 811 Last-Modified: Sat, 26 Jun 2010 21:46:46 GMT Keep-Alive: timeout=5, max=96 Connection: Keep-Alive Content-Type: text/css /* print.css - MoinMoin Default Styles Copyright (c) 2001, 2002, 2003 by Juergen Hermann */ /* snip */ #header, #sidebar, #footer, #timings, #credits, #interwiki, #pagelocation { display: none; }
MoinMoin的Apacheconfiguration文件(相当标准?):
Alias /moin_static160/ "C:/Djangostack/python/Lib/site-packages/MoinMoin/web/static/htdocs/" ScriptAlias /bgcwiki "C:/Djangostack/Moin/bgcwiki/moin.cgi" <Directory 'C:/Djangostack/Moin/bgcwiki/' > Order allow,deny Allow from all </Directory> <Directory 'C:/Djangostack/python/Lib/site-packages/MoinMoin/web/static/htdocs/' > Order allow,deny Allow from all </Directory>
如果看到截断的静态文件,请尝试closuresEnableSendfile并closuresEnableMMAP。
这确实是一个编码问题,而且是MoinMoin的一个configuration问题,而不是Apache。
问题出在configuration文件上 ,而不是任何静态文件本身。 我怀疑由于在Windows机器上编辑最初的基于Unix的文件,整个文件的编码是不一致的。 我的编辑甚至不会说编码是什么!
在将整个configuration文件转换为Unicode之后(或者真的一致),所有的东西都开始工作了。 虽然,这是如何造成这个具体问题是有点超越我。