整合 svn 与 apache

= 与apache整合 = 可参看 整合 trac 与 apache

安装

ubuntu

sudo apt-get install libapache2-svn

fedora

sudo yum install mod_dav_svn

建立密码文件

可以用建 trac 时建好的那个

htpasswd -c /home/linkage/bigzhu/svn_im/tracpwd bigzhu
htpasswd -c ~/crm/pwd bigzhu
htpasswd -c /svn/pwd bigzhu

增加用户

可以用 trac 的用户,有个插件,很方便.

直接在 trac 注册, svn 也就能用了

htpasswd  /home/linkage/bigzhu/svn_im/tracpwd yxj -p yxm
htpasswd  /home/linkage/bigzhu/svn_im/tracpwd sjw
htpasswd  /home/linkage/bigzhu/svn_im/tracpwd yinzl

== 配置 ==

ubuntu

cd /etc/apache2/sites-available 
sudo gvim /etc/apache2/sites-available/trac_svn

內容如下:

<VirtualHost *:80>
	ServerAdmin [email protected]
    
    <Location /trac>
        SetHandler mod_python
        PythonHandler trac.web.modpython_frontend
        PythonOption TracEnv "/home/bigzhu/Dropbox/trac/south"
        PythonOption TracUriRoot "/trac"
    </Location>

    <Location /svn>
        DAV svn
        SVNPath /home/bigzhu/Dropbox/svn/trac_svn_test
        AuthType Basic
        AuthName "Subversion repository"
        AuthUserFile /home/bigzhu/Dropbox/trac/south/passwd
        Require valid-user
    </Location>

</VirtualHost>

关了其它占用 80 端口的虚拟主机

关闭占用 80 的默认的 apache

sudo a2dissite default

并启用现在的这个

sudo a2ensite portal

load

sudo /etc/init.d/apache2 reload

fedora

sudo gvim /etc/httpd/conf.d/subversion.conf

放开下面的注释

<Location /repos>
   DAV svn
   SVNParentPath /var/www/svn

   * Limit write permission to list of valid users.
   <LimitExcept GET PROPFIND OPTIONS REPORT>
      * Require SSL connection for password protection.
      * SSLRequireSSL

      AuthType Basic
      AuthName "Authorization Realm"
      AuthUserFile /path/to/passwdfile
      Require valid-user
   </LimitExcept>
</Location>

权限

apache 访问目录权限问题

~~ubuntu下apache的配置文件是:apache2.conf ~~ ~~普通版本是: httpd.conf ~~ ~~这个要注意 ~~ ~~=== ubuntu === ~~ ~~bash ~~ ~~sudo vim /etc/apache2/apache2.conf ~~ ~~ ~~ ~~=== linux === ~~ ~~修改apache2.conf或者编辑(redhat) ~~ ~~bash ~~ ~~vim /usr/local/apache2/conf/httpd.conf ~~ ~~ ~~ ~~=== 加入 === ~~ ~~在最后增加,这里要指定前面建立的密码文件 ~~ ~~~~ ~~<Location /svn> ~~ ~~DAV svn ~~ ~~#SVNParentPath /home/bigzhu/Dropbox/svn_yn/ ~~ ~~SVNPath /home/bigzhu/Dropbox/svn_yn ~~ ~~#AuthzSVNAccessFile /home/bigzhu/Dropbox/svn_yn/authz.conf ~~ ~~AuthType Basic ~~ ~~AuthName "Subversion repository" ~~ ~~AuthUserFile /home/bigzhu/Dropbox/svn_yn/tracpwd ~~ ~~Require valid-user ~~ ~~#Require valid-user ~~ ~~</Location> ~~ ~~ ~~ ~~== 权限 == ~~ ~~因为apache2默认使用www-data用户来访问的,修改 svn 项目的所属为www-date ~~ ~~bash ~~ ~~sudo chown -R www-data:www-data crm_svn ~~ ~~ ~~

启动 apache

apache2启动停止重启命令

Could not reliably determine the server’s fully qualified domain name