1

我最近一直在努力设置我的虚拟主机以用于 mercurial repos 和 hgweb。我使用Nearfreespeech.net (NFSN) 进行托管。

默认情况下,NFSN 有一个 freebsd72 的 CGI 领域,并且限制你只能使用 CGI,没有 WGSI 或类似的。最初,NFSN 安装了 mercurial 1.6,但通过松散地遵循这些说明,我能够安装 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>&nbsp;</th>
    </tr>

</table>
</div>
</div>

</body>
</html>
4

1 回答 1

1

我发现 hgweb.cgi 脚本实际上需要设置为 755 权限,将其设置为可执行是不够的。

于 2013-06-19T01:29:01.833 回答