所以我刚刚第一次安装了MediaWiki,并且遇到了一个我无法找到解决方案的奇怪问题。我一直在抓取帮助文档,在过去几个小时内搜索Google并阅读文章,但找不到答案。
一切正常,除了在404页面上,在HTML之前输出四个乱码。所有其他页面看起来都很好,只有404s。它们各有所不同,看起来我是十六进制,我看过数字,没有高于f的字母。
实施例
我每次都重新安装了两次同样的问题。
系统设置
服务器配置
的Apache
<VirtualHost 127.0.0.1:8080>
DocumentRoot /home/sites/oneltd.co.uk/wiki
ServerName wiki.oneltd.co.uk
Alias /wiki /home/sites/oneltd.co.uk/wiki/index.php
<Directory "/home/sites/oneltd.co.uk/wiki">
Allowoverride all
</Directory>
CustomLog /home/sites/oneltd.co.uk/_logs/access_log "combined"
ErrorLog /home/sites/oneltd.co.uk/_logs/error_log
</VirtualHost>
nginx的
server {
listen 205.186.146.37:80;
server_name wiki.oneltd.co.uk;
server_name_in_redirect off;
access_log /home/sites/oneltd.co.uk/_logs/nginx.access_log;
location / {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location ~ \.(jpg|jpeg|png|gif|swf|flv|mp4|mov|avi|wmv|m4v|mkv|ico|js|css|txt|html|htm)$ {
root /home/sites/oneltd.co.uk/wiki;
gzip on;
gzip_comp_level 2;
gzip_vary on;
gzip_proxied any;
gzip_types text/plain text/xml text/css application/x-javascript;
expires max;
}
}
非常感谢任何寻求帮助或想法的建议:)
编辑 - 问题已修复!
感谢Greg Hewgill关于分块编码的回应,我设法找到了问题。事实证明,当作为反向代理工作时,nginx无法与HTTP / 1.1通信,但您可以强制Apache降级到1.0。我在阅读了a similar problem with Drupal
之后找到了答案更新了Apache配置:
<VirtualHost 127.0.0.1:8080>
DocumentRoot /home/sites/oneltd.co.uk/wiki
ServerName wiki.oneltd.co.uk
Alias /wiki /home/sites/oneltd.co.uk/wiki/index.php
<Directory "/home/sites/oneltd.co.uk/wiki">
Allowoverride all
</Directory>
CustomLog /home/sites/oneltd.co.uk/_logs/access_log "combined"
ErrorLog /home/sites/oneltd.co.uk/_logs/error_log
# nginx can't deal with HTTP/1.1 at the moment, force downgrade to 1.0
SetEnv force-response-1.0 1
SetEnv downgrade-1.0 1
</VirtualHost>
答案 0 :(得分:2)
这听起来可能与HTTP chunked transfer encoding有某种关联。使用分块传输,每个块的长度在实际内容之前以十六进制发送。
我不知道为什么这会在您的安装中出现问题,或者如何修复它,但在搜索解决方案时它可能是有用的信息。