【问题标题】:Running Mercurial with Apache on Windows XP在 Windows XP 上使用 Apache 运行 Mercurial
【发布时间】:2010-07-29 15:09:20
【问题描述】:

我一直在努力让 Mercurial 在 Windows XP 上与 Apache 一起工作。

我已阅读并尝试了以下 SO 线程中的建议:1234

到目前为止,我只能看到一个空白页,当我查看源代码时,我可以看到:

<body bgcolor="#f0f0f8"><font color="#f0f0f8" size="-5"> -->
<body bgcolor="#f0f0f8"><font color="#f0f0f8" size="-5"> --> -->
</font> </font> </font> </script> </object> </blockquote> </pre>
</table> </table> </table> </table> </table> </font> </font> </font>

我在做什么:

  • Apache 2.2 -- C:\Program Files\Apache Software Foundation\Apache2.2\
  • Python 2.4(由 Mercurial 网站推荐)--C:\Program Files\Python\2.4\
  • Mercurial 1.6 -- C:\Program Files\Mercurial\
  • mod_python3.3.1
  • Apache DocumentRoot:C:\htdocs\hg\ 通过http://hg.paperclip.dev 访问(添加到主机文件中)
  • Hg 存储库(在网络驱动器上):H:\repo\

我觉得部分复杂性在于我的存储库位于网络驱动器上。我可以通过网络驱动器号 H 或 \\SERVER\WebDev\repo\

访问它

我的Mercurial安装目录下的mercurial.ini如下:

[ui]
editor = Notepad
username = paperclip <p@paperclip.com>

我的 hgweb.config 在 apache 服务的 Hg DocumentRoot 中 (C:\htdocs\hg\)

[collections]
//SERVER/WebDev/repo = //SERVER/WebDev/repo**

我的 hgweb.cgi 在 apache 服务器的 Hg DocumentRoot 中 (C:\htdocs\hg\)

#!C:/Program Files/Python/2.4/python.exe

# Path to repo or hgweb config to serve (see 'hg help hgweb')
config = "C:/htdocs/hg/hgweb.config"

# Uncomment and adjust if Mercurial is not installed system-wide:
import sys; sys.path.insert(0, "C:/Program Files/Mercurial/lib")

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

from mercurial import demandimport; demandimport.enable()
from mercurial.hgweb import hgweb
from flup.server.fcgi import WSGIServer
application = hgweb(config)
WSGIServer(application).run()

我的 Apache 虚拟主机文件

<VirtualHost *:80>
  ServerName hg.paperclip.dev
  #ServerAlias paperclip.com *.paperclip.com
  ServerAdmin p@paperclip.com
  CustomLog "logs/hg-access.log" combined
  ErrorLog "logs/hg-error.log"

  RewriteEngine on
  RewriteRule (.*) C:/htdocs/hg/hgweb.cgi/$1

  # Or we can use mod_alias for starting CGI script and making URLs "nice":
  # ScriptAliasMatch ^(.*) C:/htdocs/hg/hgweb.cgi/$1

  <Directory "C:/htdocs/hg/">

    Order allow,deny
        Allow from all
        AllowOverride All
        Options ExecCGI FollowSymLinks +Indexes
        AddHandler cgi-script .cgi

  </Directory>
</VirtualHost>

考虑到上述配置,我欢迎一些建议以使其正常工作。什么我都可以尝试,因为我已经完全走到了死胡同。

非常感谢。

-P.

【问题讨论】:

    标签: apache mercurial windows-xp hgweb


    【解决方案1】:

    这是昨天发布的:
    Setup Mercurial Server in Windows Machine - Tutorials are outdated

    这个人设法让 HG + Apache 在 Windows 7 上运行。
    我知道,您使用的是 XP 而不是 Win 7,但也许这个链接对您有帮助。

    【讨论】:

      【解决方案2】:

      汞 2.0.1

      Apache 2.2.21

      Python 2.6!

      #!c:/python26/python.exe
      #
      # An example hgweb CGI script, edit as necessary
      # See also http://mercurial.selenic.com/wiki/PublishingRepositories
      
      # Path to repo or hgweb config to serve (see 'hg help hgweb')
      #config = "/path/to/repo/or/config"
      config = "c:/batch/merc-web.conf"
      
      # Uncomment and adjust if Mercurial is not installed system-wide
      # (consult "installed modules" path from 'hg debuginstall'):
      #import sys; sys.path.insert(0, "/path/to/python/lib")
      #import sys; sys.path.insert(0, "c:/mercurial")
      
      # Uncomment to send python tracebacks to the browser if an error occurs:
      import cgitb; cgitb.enable()
      
      from mercurial import demandimport; demandimport.enable()
      from mercurial.hgweb import hgweb, wsgicgi
      application = hgweb(config)
      wsgicgi.launch(application)
      

      忘记 mod_python,:81 是我机器上的 IIS,而 apache 是 80 和 91,所以 http://ap.xxx.tzo.net/cgi-bin/hgweb.cgi 有效

      <VirtualHost *:80>
      ServerName ap.xxx.tzo.net
      ServerAlias ap.xxx.tzo.net
      
      ProxyPreserveHost On
      ProxyPass / http://localhost:91/
      ProxyPassReverse / http://localhost:91/
      <Proxy http://localhost:91/>
      #  Order Allow,Deny
      #  Allow from all
         Order Deny,Allow
         Allow from 127.0.0.1
      </Proxy>
      </VirtualHost>
      

      还有 envvar PYTHONPATH C:\Python26

      我知道您使用的是不同版本的 HG 等,但我希望这会有所帮助。 我想我花了 2 天时间;)

      尝试使用本地存储库,您的 mercurial.ini 是 N/A。我的 merc-web.conf 看起来像:

      [web]
      style = coal
      
      [paths]
      /hgAppThree = C:\!mark\_dev\hgAppThree
      

      适用于

      http://ap.xxx.tzo.net/cgi-bin/hgweb.cgi/hgAppThree

      祝你好运!

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-03-21
        • 2014-10-08
        • 1970-01-01
        • 2016-12-02
        • 1970-01-01
        相关资源
        最近更新 更多