您的位置:首页 > 运维架构 > Apache

mecurial 服务器认证配置(mecurial + apache + mod_wsgi + python )

2012-11-23 20:13 615 查看
安装Apache: sudo apt-get install apache2安装mod_wsgi: sudo apt-get install libapache2-mod-wsgi安装Mercurial:源码安装,稳定版,见hg安装(目前是2.4)的下载网页[1] hgweb.wsgi在源码mercurail-2.4/contrib下配置hgrc
sudo mkdir /etc/mercurial添加:[web]allow_push = *push_ssl = falseallow_archive = gz, zip, bz2[trusted]users = www-data
.hgrc的添加:
cdvim .hgrc#type the following[ui]username = usertest
建立测试目录:
cd ~ # go to home directorymkdir repository1cd repository1hg initecho Hello World! > readme.txthg add readme.txthg statushg commit -m 'My first repository!'hg tip # shows the tip of the repository
建立主机目录 cd /varsudo mkdir hgsudo mkdir hg/repositoriessudo chown -R root:www-data hg配置hgweb.config文件 cd /var/hgsudo vim hgweb.config#type following[web]style = gitweb[collections]/var/hg/repositories = /var/hg/repositories配置hgweb.wsgi cd /var/hgsudo cp /home/lijian/Downloads/mercurial-2.4/contrib/hgweb.wsgi .sudo chmod a+x hgweb.wsgisudo vim hgweb.wsgi修改:config = "/var/hg/hgweb.config"配置apache cd /etc/apache2/sudo mkdir mercurialcd mercurial/sudo vim mercurial.conf内容:WSGIScriptAliasMatch ^/hg(.*) /var/hg/hgweb.wsgi$1<Directory "/var/hg/">Options Indexes FollowSymlinks MultiViews ExecCGIAllowOverride AllOrder allow,denyAllow from allAuthType BasicAuthName "Mercurial Repositories"AuthUserFile /var/hg/hgusersRequire valid-user</Directory>
cd
/etc/apache2/sites-available
sudo
nano default
# Type on the line before
Include
/etc/apache2/mercurial/mercurial
.conf
#restart the apache server so the changes take effect
sudo
apache2ctl restart
如有问题查看/var/log/apache2/error.log [tail /var/log/apache2/error.log]
测试      cd ~ # go to your home drivesudo mv test/ /var/hg/repositories/.sudo chown -R root:www-data /var/hg/建立用户密码文件      cd /var/hgsudo htpasswd -mc hgusers admin #建立adminsudo chown root:www-data hgusers添加其它用户      cd /var/hgsudo htpasswd -m hgusers {username}# 添加用户username用http://localhost/hg,访问      参考:[1]: [http://mercurial.selenic.com/release/?M=D][2]:[http://omarfrancisco.com/setting-up-a-mercurial-repository-in-ubuntu-11-10/][3]:[http://www.linuxidc.com/Linux/2011-07/39290.htm][4]:官网介绍:[http://mercurial.selenic.com/wiki/PublishingRepositories]
                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: