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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章