在Apache / Windows的服务器水银 [英] Mercurial Server on Apache/Windows

查看:152
本文介绍了在Apache / Windows的服务器水银的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在寻找与Apache设置信息用于Windows的水银服务器(7或XP)(XAMPP如果它是有用的知道它)与推模式,就像在的this问题但我的团队由5至8(unsolvent)的家伙谁是每一个在分离的地方工作,所以我不觉得到位桶溶液或电气特性的非私有回购在那里。

我觉得这个帖子会做的伎俩,但我以前没有经历过的CGI什么,

有没有人这样做过?我在哪里可以找到更详细的解释?在此先感谢

我现在收到此错误:脚本头premature结束:hgwebdir.cgi

日志错误说不叫善变模块

这是我的hgwebdir.cgi文件

 #!C:/python24/python.exe

#一个例子CGI脚本导出多个hgweb回购协议,根据需要编辑#调整蟒蛇路径,如果没有一个全系统的安装:
进口SYS
sys.path.insert(0,C:/ mercurial_library)#使进口需求减少启动时间
从善变进口demandimport; demandimport.enable()#取消派蟒蛇回溯到浏览器,如果发生错误:
#进口cgitb
#cgitb.enable()#如果你想成为使用UTF-8,而不是默认的网页
#语言环境字符集,可以通过取消注释以下行这样做。
#注意,这将导致您的.hgrc文件是在跨preTED
#UTF-8和所有回购文件使用UTF-8显示。

#进口OS
#os.environ [HGENCODING] =​​UTF-8从mercurial.hgweb.hgwebdir_mod进口hgwebdir
进口mercurial.hgweb.wsgicgi作为wsgicgi
应用= hgwebdir('hgweb.config')
wsgicgi.launch(应用程序)


解决方案

我用来自硒站点HgWebDir说明:

下面是我的善变网站(稍微改动过)的httpd.conf片:

 <虚拟主机*:88>
    服务器名hg.example.com
    的DocumentRoot C:/ apache_sites / HG
    RewriteEngine叙述上    重写规则^ / $ /公共[R]
    重写规则^ /公共(。*)/public/hgwebdir.cgi$1 [L]
    重写规则^ /私有(。*)/private/hgwebdir.cgi$1 [L]    #mod_alias中的替代(pretty的URL)
    <目录c:/ apache_sites / HG>
        为了允许,拒绝
        所有允许
        所有的AllowOverride
        选项​​ExecCGI
        AddHandler的CGI脚本的CGI
    < /目录>
    <位置/私营/>
        摘要进行AuthType
        AuthName指令hg.example.com
        AuthDigestProvider指令文件
        的AuthUserFile C:/ apache_sites / HG / hgusers
        目录AuthGroupFile C:/ apache_sites / HG / hggroup
        AuthDigestDomain /私营/
        需要组所有者
    < /地点>
    <位置/公/>
        摘要进行AuthType
        AuthName指令hg.example.com
        AuthDigestProvider指令文件
        的AuthUserFile C:/ apache_sites / HG / hgusers
        目录AuthGroupFile C:/ apache_sites / HG / hggroup
        AuthDigestDomain /公/
        < LimitExcept中GET>
            需要开发组
        < / LimitExcept中>
    < /地点>    LogLevel的调试
    错误日志C:/apache/logs/hg-error.log
    的CustomLogC:/apache/logs/hg-access.log组合拳
    LogLevel的调试
< /虚拟主机>
#VIM:东南英尺=阿帕奇:

我也不得不把对验证文摘等。

几个模块

我把hgwebdir.cgi在公共和私人文件夹的根,只是把我的每个汞回购的回购子文件夹中相应的文件夹下。

Apache的认证了我的授权服务。

然后我只是把hgweb.config文件中像这样的同一位置:

  [收藏]
回购协议回购=[网络]
allow_archive = BZ2 GZ拉链
风格=叫做gitweb
baseURL时= /公

更新问题

善变的包必须在PYTHON_PATH

<一个href=\"http://stackoverflow.com/questions/2123798/error-setting-up-mercurial-on-windows-server-2008/2129114#2129114\">This回答提供了更多的细节。

I'm searching for info to setup a Mercurial Server for Windows (7 or XP) with an Apache (xampp if it is useful to know it) with the Push Model, just like in this question but my team is composed of 5 to 8 (unsolvent) guys who are each one working in separated places, so I don't think the bitbucket solution or anyother non-private repo out there.

I think this post would do the trick, but i haven't experienced anything with cgi before,

Has anybody done this before? where can I find a more detailed explanation? thanks in advance

[EDIT]

I'm now getting this error: Premature end of script headers: hgwebdir.cgi

The log error says "no module named mercurial"

this is my hgwebdir.cgi file

#!c:/python24/python.exe
#
# An example CGI script to export multiple hgweb repos, edit as necessary

# adjust python path if not a system-wide install:
import sys
sys.path.insert(0, "c:/mercurial_library")

# enable importing on demand to reduce startup time
from mercurial import demandimport; demandimport.enable()

# Uncomment to send python tracebacks to the browser if an error occurs:
#import cgitb
#cgitb.enable()

# If you'd like to serve pages with UTF-8 instead of your default
# locale charset, you can do so by uncommenting the following lines.
# Note that this will cause your .hgrc files to be interpreted in
# UTF-8 and all your repo files to be displayed using UTF-8.
#
#import os
#os.environ["HGENCODING"] = "UTF-8"

from mercurial.hgweb.hgwebdir_mod import hgwebdir
import mercurial.hgweb.wsgicgi as wsgicgi
application = hgwebdir('hgweb.config')
wsgicgi.launch(application)

解决方案

I used the HgWebDir instructions from the selenic site:

Here is my httpd.conf piece for the mercurial sites (slightly edited):

<VirtualHost *:88>
    ServerName hg.example.com
    DocumentRoot c:/apache_sites/hg
    RewriteEngine on

    RewriteRule ^/$ /public [R]
    RewriteRule ^/public(.*) /public/hgwebdir.cgi$1 [L]
    RewriteRule ^/private(.*) /private/hgwebdir.cgi$1 [L]

    # mod_alias alternative (pretty url's)
    <Directory c:/apache_sites/hg >
        Order allow,deny
        Allow from all
        AllowOverride All
        Options ExecCGI
        AddHandler cgi-script .cgi
    </Directory>
    <Location /private/>
        AuthType Digest
        AuthName "hg.example.com"
        AuthDigestProvider file
        AuthUserFile c:/apache_sites/hg/hgusers
        AuthGroupFile c:/apache_sites/hg/hggroup
        AuthDigestDomain /private/
        Require group owner
    </Location>
    <Location /public/>
        AuthType Digest
        AuthName "hg.example.com"
        AuthDigestProvider file
        AuthUserFile c:/apache_sites/hg/hgusers
        AuthGroupFile c:/apache_sites/hg/hggroup
        AuthDigestDomain /public/
        <LimitExcept GET>
            Require group developer
        </LimitExcept>
    </Location>

    LogLevel debug
    ErrorLog "c:/apache/logs/hg-error.log"
    CustomLog "c:/apache/logs/hg-access.log" combined
    LogLevel debug
</VirtualHost>
# vim:se ft=apache:

I also had to turn on a few modules for Auth Digest, etc.

I put the hgwebdir.cgi in the root of the public and the private folders, and just put each of my hg repos in the repos subfolder under the appropriate folders.

Apache authentication took care of my authorization.

Then I just put a hgweb.config file in the same locations like this:

[collections]
repos = repos

[web]
allow_archive = bz2 gz zip
style = gitweb
baseurl = /public

Updated Question

The mercurial packages need to be on the PYTHON_PATH

This answer gives more detail.

这篇关于在Apache / Windows的服务器水银的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆