我最近一直在努力设置我的webhost用于mercurial repos以及hgweb。我使用nearlyfreespeech.net(NFSN)进行托管。
默认情况下,NFSN有一个freebsd72的CGI领域,并且只限制CGI,没有WGSI等。最初,NFSN安装了mercurial 1.6但是通过松散地遵循these指令,我能够获得mercurial 2.6设置。默认情况下,Python 2.6.6也安装在主机上,我保留原样。
我现在的问题是我无法在浏览器中加载hgweb.cgi文件。当我在我的主机上通过SSH运行它运行良好并输出HTML,但在我的浏览器中我得到500内部服务器错误。该文件是可执行的,并且启用了CGI。我不确定还有什么可以检查...有没有人在NFSN上使用hg和hgweb有任何建议或经验?
正如评论中所建议的那样,我检查了创建的错误日志,发现当我访问该网站时,我得到了...
[Sun Jun 16 08:22:31 2013] [error] [client 172.17.0.141] CGI ERROR: A system problem prevented your request from being completed.
[Sun Jun 16 08:22:31 2013] [error] [client 172.17.0.141] Premature end of script headers: hgweb.cgi
对该错误进行一些搜索会发现这意味着脚本在运行时可能无法生成正确的标头。如果我将脚本的输出保存到文件中,我会得到以下内容......
Status: 200 Script output follows
Content-Type: text/html; charset=US-ASCII
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
<head>
<link rel="icon" href="/static/hgicon.png" type="image/png" />
<meta name="robots" content="index, nofollow" />
<link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
<title>Mercurial repositories index</title>
</head>
<body>
<div class="container">
<div class="menu">
<a href="http://mercurial.selenic.com/">
<img src="/static/hglogo.png" width=75 height=90 border=0 alt="mercurial" /></a>
</div>
<div class="main">
<h2>Mercurial Repositories</h2>
<table class="bigtable">
<tr>
<th><a href="?sort=name">Name</a></th>
<th><a href="?sort=description">Description</a></th>
<th><a href="?sort=contact">Contact</a></th>
<th><a href="?sort=lastchange">Last modified</a></th>
<th> </th>
</tr>
</table>
</div>
</div>
</body>
</html>
答案 0 :(得分:1)
我能够发现hgweb.cgi脚本实际上需要设置为755权限,将其设置为可执行文件是不够的。