apache + mercurial的整合

一 apache 和 mercurial的安装

  sudo apt-get install apache2 mercurial meld

二 apache和mercurial的整合

1 sudo cp /usr/share/doc/mercurial/examples/hgweb.cgi  /var/www/

2 修改apache中心配置文件

   sudo vim /etc/apache2/sites-available/default

修改完成如下:

ServerAdmin webmaster@localhost

DocumentRoot /var/www

Options FollowSymLinks

AllowOverride None

Options Indexes FollowSymLinks MultiViews

AllowOverride None

Order allow,deny

allow from all

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/

AllowOverride None

Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch

Order allow,deny

Allow from all

ErrorLog ${APACHE_LOG_DIR}/error.log

# Possible values include: debug, info, notice, warn, error, crit,

# alert, emerg.

LogLevel warn

CustomLog ${APACHE_LOG_DIR}/access.log combined

    Alias /doc/ "/usr/share/doc/"

        Options Indexes MultiViews FollowSymLinks

        AllowOverride None

        Order deny,allow

        Deny from all

        Allow from 127.0.0.0/255.0.0.0 ::1/128

#### Added by dylan ###########

ScriptAlias /hg "/var/www/hgweb.cgi"

    AuthType Basic

AuthName "Mercurial repositories"

AuthUserFile /var/www/hgusers

Require valid-user

4 建立/var/www/hgweb.config文件,内容如下:

[collections]

/var/hg/repos = /var/hg/repos

[web]

allow_push = *

push_ssl = false

5 添加登录用户和密码

sudo htpasswd -c /var/www/hgusers user1

sudo htpasswd  /var/www/hgusers user2

6 修改hgweb.sgi文件

config = "/var/www/hgweb.config"

7 修改几个文件的权限

sudo chmod a+r /var/www/hgusers

sudo chmod a+x /var/www/hgweb.cgi

sudo chmod a+r /var/www/hgweb.config

sudo chmod -R a+w /var/hg/repos (自己建立,所有仓库都在这个文件夹下:sudo mkdir -p /var/hg/repos)

8 http://localhost/hg

猜你喜欢

转载自q16964777.iteye.com/blog/2263977