在 Windows XP 上使用 Apache 运行 Mercurial

发布于 2024-09-12 04:26:24 字数 3530 浏览 3 评论 0原文

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

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

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

<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_python 3.3.1
  • Apache DocumentRoot: C:\htdocs\hg\< /code> 通过 http://hg.paperclip.dev 访问(添加到主机文件)
  • Hg 存储库(在网络驱动器上): H:\repo\

我有我觉得复杂的部分原因是我的存储库位于网络驱动器上。我可以通过网络驱动器号 H 或通过 \\SERVER\WebDev\repo\ 访问

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

[ui]
editor = Notepad
username = paperclip <[email protected]>

My < code>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 VirtualHosts 文件

<VirtualHost *:80>
  ServerName hg.paperclip.dev
  #ServerAlias paperclip.com *.paperclip.com
  ServerAdmin [email protected]
  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。

I've been struggling to get Mercurial working with Apache on Windows XP.

I've read and tried the suggestions at the following SO threads: 1, 2, 3 & 4

So far all I can is a blank page and when I view the source I can see:

<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>

What I'm working with:

  • Apache 2.2 -- C:\Program Files\Apache Software Foundation\Apache2.2\
  • Python 2.4 (as recommended by Mercurial site) -- C:\Program Files\Python\2.4\
  • Mercurial 1.6 -- C:\Program Files\Mercurial\
  • mod_python 3.3.1
  • Apache DocumentRoot: C:\htdocs\hg\ accessed via http://hg.paperclip.dev (added to hosts file)
  • Hg Repository (on a networked drive): H:\repo\

I have a feel that part of the complication is that I have my repo on a networked drive. Which I can access either through a networked drive letter H or via \\SERVER\WebDev\repo\

My mercurial.ini in the Mercurial installation directory is as follows:

[ui]
editor = Notepad
username = paperclip <[email protected]>

My hgweb.config in the Hg DocumentRoot served by apache (C:\htdocs\hg\)

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

My hgweb.cgi in the Hg DocumentRoot serverd by apache (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()

My VirtualHosts files for Apache

<VirtualHost *:80>
  ServerName hg.paperclip.dev
  #ServerAlias paperclip.com *.paperclip.com
  ServerAdmin [email protected]
  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>

Taking into account the above configuration, I would welcome some suggestions to get this working. Anything I could try as I've hit a total dead end.

Many thanks in advance.

-P.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

许你一世情深 2024-09-19 04:26:24

这是昨天发布的:
在 Windows 计算机中设置 Mercurial Server - 教程已过时

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

This was posted just yesterday:
Setup Mercurial Server in Windows Machine - Tutorials are outdated

This guy managed to get HG + Apache to work on Windows 7.
I know, you're using XP and not Win 7, but maybe this link helps you anyway.

雪若未夕 2024-09-19 04:26:24

Hg 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 不适用。我的 Merc-web.conf 看起来像:

[web]
style = coal

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

适用于

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

祝你好运!

Hg 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)

forget about mod_python, :81 is IIS on my machine and apache is on 80 and 91, so http://ap.xxx.tzo.net/cgi-bin/hgweb.cgi works

<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>

also envvar PYTHONPATH C:\Python26

I realize you are on different version of HG etc, but I hope this helps.
I think it took me 2 days ;)

Try with a local repo, your mercurial.ini is N/A. My merc-web.conf looks like:

[web]
style = coal

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

which applies like

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

Good luck!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文