我正在尝试发布 hg 存储库。我正在为多个存储库使用 hg 1.7.3
和 hgweb
。在索引页面上显示了存储库名称,但是当我单击它们时,我得到了有关断开链接的信息。 Apache 错误日志说:
[Tue Feb 01 15:41:31 2011] [error] [client 10.13.3.64] script not found or unable to stat: /home/hg/webdir/index.cgienigma-reports, referer: http://hg.internal/
我正在尝试访问路径 http://hg.internal/enigma-reports/
。知道我可能做错了什么吗?
我在 sites-available 中的配置如下所示:
<VirtualHost *>
ServerName hg.internal
ScriptAlias / "/home/hg/webdir/index.cgi/"
</VirtualHost>
之前 index.cgi 的路径中没有尾部斜杠。为什么需要尾部斜线?现在它看起来像一个目录,而不是一个文件,看起来非常违反直觉。
最佳答案
您的 ScriptAlias
行可能有误——缺少尾部斜杠。
这是必需的,因为 ScriptAlias 将第一部分替换为第二部分。
因此当您的 URL 出现时:
http://hg.internal/enigma-reports/
协议(protocol)和主机的 apache lops 变成了:
/enigma-reports/
然后 ScriptAlias 匹配第一个 /
并进行替换,在您更新之前添加该斜线产生
/home/hg/webdir/index.cgienigma-reports/
这不是一个有效的脚本。
但是,使用新的斜线替换为:
/home/hg/webdir/index.cgi/enigma-reports/
将 engigma-reports/
转换为 PATH_INFO
CGI 变量,这是脚本所查看的内容。
关于mercurial - hgweb : repositories are displayed, 但无法访问,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4863884/