如何在IIS上设置Mercurial和hgwebdir? [英] How to setup Mercurial and hgwebdir on IIS?
问题描述
我一直在寻找关于如何让hgwebdir在IIS上工作的体面指示,但我没有找到太多值得的东西。
I've been looking all over for decent instructions on how to get hgwebdir working on IIS but I haven't found much of worth.
有 Mercurial维基上的一步一步,但它并不是很好。
还有这个和这个,但是再一次,我找不到引导它们开始的好方法。
There's this "step by step" on the Mercurial wiki, but it's not very good. There's also this and this, but again, I can't find good steps to lead up to where those get started.
推荐答案
我昨天刚刚安装了一个新的Mercurial实例,这里是更新的说明for 1.7:
I just had to install a fresh Mercurial instance yesterday, here's updated instructions for 1.7:
- 安装Mercurial (这些说明已经过1.7测试)
- 安装Python (对于Mercurial 1.7,您必须使用x86版本的Python 2.6.6)
- 您需要下载hgweb.cgi文件来自Mercurial来源。您可以通过以下方式下载源代码:
hg clone https://www.mercurial-scm.org/repo/hg/
-
创建一个将成为您的Web应用程序文件夹的文件夹。您需要将三件事复制到此文件夹中:
- Install Mercurial (these instructions were tested with 1.7)
- Install Python (for Mercurial 1.7, you must use the x86 version of Python 2.6.6)
- You will need to download the hgweb.cgi file from the Mercurial source. You can download the source by running:
hg clone https://www.mercurial-scm.org/repo/hg/
Create a folder that will be your web application folder. You will need to copy three things into this folder:
- hgweb.cgi文件
- 来自C:\Program Files \ Mercurial文件夹的Library.zip的内容
- C:\Program Files \ Mercurial中的Templates文件夹
您需要确保在IIS中设置了Python。
You will need to make sure you have Python set up in IIS.
- 通过以下方式启用CGI:控制面板 - >打开或关闭Windows功能 - >角色 - > Web服务器(IIS) - >添加角色服务 - >检查CGI
- 在IIS中创建一个新网站并确保物理路径是您在上面创建的文件夹
- 在新网站的Handler Mappings中,选择添加脚本地图 。输入 *。cgi 作为请求路径, c:\Python26 \ python.exe -u%s表示可执行文件, Python 强>为名字。
- Enable CGI via the following: Control Panel -> Turn Windows Features On or Off -> Roles -> Web Server (IIS) -> Add Role Services -> Check CGI
- Create a new Web Site in IIS and make sure the physical path is the folder you created above
- In the Handler Mappings for the new website, select "Add Script Map". Enter *.cgi for the request path, c:\Python26\python.exe -u "%s" for the Executable, and Python for the Name.
您还需要创建一个名为hgweb.config的文件,其内容类似于以下内容。文件中的路径需要是驱动器上要存储Mercurial存储库的位置:
You will also need to create a file named "hgweb.config" with contents similar to below. The path within the file needs to be the location on your drive where you want to store the Mercurial repositories:
[collections]
c:\ Mercurial\repos = c:\ Mercurial\repos
[collections]
c:\Mercurial\repos = c:\Mercurial\repos
编辑hgweb.cgi文件并更改设置hgweb路径的行。配置如下所示(无论hgweb.config文件在哪里):
Edit the hgweb.cgi file and change the line where it sets the path to your hgweb.config to something like the following (wherever the hgweb.config file is):
config =C:\ Mercurial\hgweb.config
config = "C:\Mercurial\hgweb.config"
另外,请查看 Jeremy Skinners博客文章。它有点过时,但有一些额外的好步骤,比如为更干净的URL设置URL重写。
Also, check out Jeremy Skinners blog post . It's a little outdated, but has some extra nice steps like setting up URL re-writing for cleaner URL's.
这篇关于如何在IIS上设置Mercurial和hgwebdir?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!