Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Mercurial和Apache_Apache_Mercurial - Fatal编程技术网

使用Mercurial和Apache

使用Mercurial和Apache,apache,mercurial,Apache,Mercurial,我正在使用Mercurial 1.7和Apache 2.2.3。我正在尝试使用hgwebdir.cgi脚本来验证和服务我的存储库,这些存储库位于/var/lib/mercurial server/repos 虽然身份验证有效,但该网页不显示任何存储库 这是我的/var/www/cgi hg/hgwebdir.cgi: config = "/var/lib/mercurial-server/repos/" import sys; sys.path.insert(0, "/usr/lib64/pyt

我正在使用Mercurial 1.7和Apache 2.2.3。我正在尝试使用hgwebdir.cgi脚本来验证和服务我的存储库,这些存储库位于/var/lib/mercurial server/repos

虽然身份验证有效,但该网页不显示任何存储库

这是我的/var/www/cgi hg/hgwebdir.cgi:

config = "/var/lib/mercurial-server/repos/"
import sys; sys.path.insert(0, "/usr/lib64/python2.4/")
import cgitb; cgitb.enable()

from mercurial import demandimport; demandimport.enable()
from mercurial.hgweb import hgweb, wsgicgi
application = hgweb(config)
wsgicgi.launch(application)
这是我的/var/www/cgi hg/hgwebdir.config:

[collections]
/var/lib/mercurial-server/repos=/var/lib/mercurial-server/repos

[web]
allow_push = *
style = gitweb
push_ssl = False
这是my/etc/httpd/conf/httpd.conf(进行更改的部分):

DocumentRoot”/var/www/cgi-hg“
选项ExecCGI FollowSymLinks
不允许超限
命令允许,拒绝
通融
选项ExecCGI索引跟随符号链接
不允许超限
DirectoryIndes index.html index.html.var hgwebdir.cgi
ScriptAlias/hg“/var/www/cgi-hg/hgwebdir.cgi”
AuthType Basic
AuthName“需要登录”
AuthUserFile/usr/local/etc/users
需要有效用户
在hgwebdir.cgi中使用config=“/var/lib/mercurial server/repos/”和config=“/var/hg/hgwebdir.config”会显示空的存储库页面。即使/var/hg/中没有hgwebdir.config

使用config=“/var/www/cgi hg/hgwebdir.config”会给我一个显示OSError的页面。部分页面显示:

/var/www/cgi-hg/hgwebdir.cgi
(highlighted) 22 application = hgweb(config)
application undefined, hgweb = <function hgweb>, config = '/var/www/cgi-hg/hgwebdir.config'

/usr/lib64/python2.4/site-packages/mercurial/hgweb/__init__.py in hgweb(config='/var/www/cgi-hg/hgwebdir.config', name=None, baseui=None)
(highlighted) 26 return hgwebdir_mod.hgwebdir(config, baseui=baseui)
...
/var/www/cgi-hg/hgwebdir.cgi
(突出显示)22应用程序=hgweb(配置)
应用程序未定义,hgweb=,config='/var/www/cgi hg/hgwebdir.config'
/hgweb中的usr/lib64/python2.4/site packages/mercurial/hgweb/__init__uu;.py(config='/var/www/cgi hg/hgwebdir.config',name=None,baseui=None)
(突出显示)26返回hgwebdir_mod.hgwebdir(配置,baseui=baseui)
...
我还注意到,每当我重新启动httpd时,我都会收到两条消息:

Starting httpd: [date time] [warn] The ScriptAlias directive in /etc/httpd/conf/httpd.conf at line 570 will probably never match because it overlaps an earlier ScriptAliasMatch.
httpd: Could not reliably determine the server's fully qualified domain name, using <IP address> for ServerName
启动httpd:[date-time][warn]第570行/etc/httpd/conf/httpd.conf中的ScriptAlias指令可能永远不会匹配,因为它与先前的ScriptAliasMatch重叠。
httpd:无法可靠地确定服务器的完全限定域名,使用for ServerName
我的httpd.conf中没有ScriptAliasMatch

当我将浏览器指向/hg时,系统会要求我进行身份验证,然后我要么得到空的存储库页面,要么得到Python错误,这取决于我在hgwebdir.cgi中使用的配置

如果我使用“hgserve--webdir conf/var/www/cgi hg/hgwebdir.config”,我的所有存储库都会正确显示

我对apache很陌生,所以我肯定我出了什么问题。请告知


谢谢。

我不知道ScriptAlias警告,但我认为您的
/var/www/cgi hg/hgwebdir.cgi
文件的行应该从当前的:

config = "/var/lib/mercurial-server/repos/"

当您为单个回购提供服务时,它是该回购的路径;当您为多个文件提供服务时,它是hgweb配置文件的路径

通过将
样式
更改为非常明显的样式,如
煤炭
(深灰色),可以确保它正在读取hgwebdir.config文件。如果您没有看到更改,那么它只是以默认值运行

一旦你开始工作,你应该把Apache配置也锁定一点。一个人的DocumentRoot通常不是包含CGI的目录(你不希望人们在
/hg
之外的区域闲逛),同样,作为一般规则,你不应该为整个文件系统(
目录
)启用
ExecCGI
选项


不过,首先,请确保它确实在读取您的hgwebdir.config文件,然后再进行处理。

我确实将配置更改为“/var/www/cgi hg/hgwebdir.config”,但它给了我上面提到的操作错误。您从哪里获得的hgwebdir.cgi?您使用的是Mercurial 1.7,但在1.6版中hgwebdir.cgi被重命名为hgweb.cgi。最新消息如下:。指向实际配置文件的config参数对于多个repo绝对正确。让它工作起来,你就可以上路了。您确定您的web服务器用户可以读取所有相关文件吗?您是否也可能安装了较早出现在PYTHON_路径中的旧mercurial?我安装了mercurial 1.7而不是1.4.3。如何检查PYTHON_路径?
config = "/var/lib/mercurial-server/repos/"
config = "/var/www/cgi-hg/hgwebdir.config"