`
lz1130
  • 浏览: 403445 次
  • 性别: Icon_minigender_1
  • 来自: 福建
社区版块
存档分类
最新评论

nginx subversion apache 安装配置

阅读更多
由于nginx现在暂时不支持subversion,而web服务器又选择了nginx,所以只能安装apache集成subversion,然后通过nginx proxy给apache来实现nginx的svn

这里用的服务器版本是:ubuntu server 8.04 32bit
并且已经认为你安装了nginx

nginx的安装可以看另一篇博客nginx php 安装与配置


Apache安装
sudo apt-get install apache2
sudo apt-get install apache2-utils


Subversio与libapache2-svn安装
sudo apt-get install subversion subversion-tools libapache2-svn


把svn模块添加到/etc/apache2/mods-enabled中
cd /etc/apache2/mods-enabled
ln -s ../mods-available/dav_fs.* ./
ln -s ../mods-available/dav_svn.* ./
ln -s ../mods-available/dav.load ./


建立svn文件库
sudo mkdir /home/workhome/svn
sudo svnadmin create /home/workhome/svn/test
ls  -l /home/workhome/svn/test
看到以下文件则成功
-rw-r--r-- 1 root root  229 Oct  7 14:22 README.txt
drwxr-xr-x 2 root root 4096 Oct  7 14:22 conf
drwxr-sr-x 6 root root 4096 Oct  7 14:22 db
-r--r--r-- 1 root root    2 Oct  7 14:22 format
drwxr-xr-x 2 root root 4096 Oct  7 14:22 hooks
drwxr-xr-x 2 root root 4096 Oct  7 14:22 locks


权限设置
sudo chown -R ftp:ftp /home/workhome/svn
sudo chown -R www-data /home/workhome/svn/test


配置svn的VirtualHost
sudo mv /etc/apache2/sites-available/default /etc/apache2/sites-available/svn.sends.cc.conf
cd /etc/apache2/sites-enabled/
sudo rm default
sudo ln -s /etc/apache2/sites-available/svn.sends.cc.conf ./
sudo vi svn.sends.cc.conf


配置文件如下:

NameVirtualHost *
<VirtualHost *>
        ServerAdmin webmaster@sends.cc

<Location />

  # Uncomment this to enable the repository
  DAV svn

  # Set this to the path to your repository
  #SVNPath /home/workhome/svn/test
  # Alternatively, use SVNParentPath if you have multiple repositories under
  # under a single directory (/var/lib/svn/repo1, /var/lib/svn/repo2, ...).
  # You need either SVNPath and SVNParentPath, but not both.
  SVNParentPath /home/workhome/svn

#---------------------
  SVNListParentPath On
  SVNAutoversioning On
#---------------------

  # Access control is done at 3 levels: (1) Apache authentication, via
  # any of several methods.  A "Basic Auth" section is commented out
  # below.  (2) Apache <Limit> and <LimitExcept>, also commented out
  # below.  (3) mod_authz_svn is a svn-specific authorization module
  # which offers fine-grained read/write access control for paths
  # within a repository.  (The first two layers are coarse-grained; you
  # can only enable/disable access to an entire repository.)  Note that
  # mod_authz_svn is noticeably slower than the other two layers, so if
  # you don't need the fine-grained control, don't configure it.

  # Basic Authentication is repository-wide.  It is not secure unless
  # you are using https.  See the 'htpasswd' command to create and
  # manage the password file - and the documentation for the
  # 'auth_basic' and 'authn_file' modules, which you will need for this
  # (enable them with 'a2enmod').
  AuthType Basic
  AuthName "Subversion Repository Of SendsLab"
  AuthUserFile /etc/apache2/dav_svn.passwd

  # To enable authorization via mod_authz_svn
  AuthzSVNAccessFile /etc/apache2/dav_svn.authz

  # The following three lines allow anonymous read, but make
  # committers authenticate themselves.  It requires the 'authz_user'
  # module (enable it with 'a2enmod').
  #<LimitExcept GET PROPFIND OPTIONS REPORT>
    Require valid-user
  #</LimitExcept> 

</Location>


        DocumentRoot /var/www/
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

        ErrorLog /var/log/apache2/svn.sends.cc.error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog /var/log/apache2/svn.sends.cc.access.log combined
        ServerSignature On

    Alias /doc/ "/usr/share/doc/"
    <Directory "/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
    </Directory>

</VirtualHost>


建立密码文件dav_svn.passwd
sudo htpasswd -c /etc/apache2/dav_svn.passwd root
建立其他用户及修改密码
sudo htpasswd  /etc/apache2/dav_svn.passwd isends


建立授权文件dav_svn.authz
sudo cp /home/workhome/svn/test/conf/authz /etc/apache2/dav_svn.authz
内容参考如下:
### This file is an example authorization file for svnserve.
### Its format is identical to that of mod_authz_svn authorization
### files.
### As shown below each section defines authorizations for the path and
### (optional) repository specified by the section name.
### The authorizations follow. An authorization line can refer to:
###  - a single user,
###  - a group of users defined in a special [groups] section,
###  - an alias defined in a special [aliases] section,
###  - all authenticated users, using the '$authenticated' token,
###  - only anonymous users, using the '$anonymous' token,
###  - anyone, using the '*' wildcard.
###
### A match can be inverted by prefixing the rule with '~'. Rules can
### grant read ('r') access, read-write ('rw') access, or no access
### ('').

[aliases]
# joe = /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil, Ltd./OU=Research Institute/CN=Joe Average

[groups]
sendsadmin = root
sendstest = sendstest
other = isends

[/]
@sendsadmin = rw
@sendstest = r
* =

[test:/]
@sendsadmin = rw
@sendstest = rw
* =



更改apache端口
sudo vi /etc/apache2/ports.conf
这里改成20080
ps:别忘了防火墙打开端口


Nginx配置(我nginx的虚机主机都在vhost下)
sudo vi /usr/local/web/nginx636/conf/vhost/svn.sends.cc.conf
加入以下:
    server {
        listen       80;
        server_name  svn.sends.cc;
        access_log   /var/log/nginx/svn.sends.cc.access.log  main;
        root  /home/workhome/svn;

         location / {
                   proxy_set_header Host $host;
                   proxy_set_header X-Real-IP $remote_addr;
                   proxy_set_header X-Forwarded-Proto https;
                   proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                   proxy_pass http://127.0.0.1:20080;
         }
    }


svn客户端与使用
svn客户端TortoiseSVN,使用很简单,安装后在任意盘符建立一个目录,右键单击目录选择“SVN 检出”。输入svn文件库地址(如http://svn.sends.cc/test)、账号、密码便可迁出项目。
1
0
分享到:
评论

相关推荐

    常用Java Web应用软件 (LNMJ,LAMJ)安装

    本文主要总结了在Ubuntu10下常用Java Web应用软件的安装,特别是LNMJ Web(Linux+Nginx+Mysql+Java Tomcat)架构和LAMJ Web(Linux+Apache+Mysql+Java Tomcat)架构下的软件安装。为进一步配置和实现LNMJ和LAMJ架构(负载...

    subversion-1.6.9 and deps-1.6.9

    最新的svn版本,原生态下载。在nginx服务下使用的svn版本,脱离apache服务。

    win7 php +apache+mysql安装包分卷1

    包含Apache 2.2.16、Mysql 5.1.51、PHP 5.2.14(ZendDebugger、ZendOptimizer)、PHP 5.3.3(XDebug、XCache)、Nginx 0.8.52、memcached 1.4.5、Subversion 1.6.12、PHPUnit 3.4.15、phpDocumentor 1.4.3、...

    如何在Linux环境下安装SVN服务器

     安装一个全新的SVN服务器,因为我们打算之后使用http的形式来访问我们的svn server , 所以我们需要提前安装一个web服务器,比如Apache的httpd、nginx、lighttpd等, 这几个服务器里面任选一个可以了 , 功能都是...

    CoreAMP 20101010

    包含Apache 2.2.14、Mysql 5.1.44、PHP 5.2.13(ZendDebugger、ZendOptimizer)、PHP 5.3.2(XDebug、XCache)、Nginx 0.7.65、memcached 1.4.4、Subversion 1.6.9、PHPUnit 3.4.11、phpDocumentor 1.4.3、...

    htan:这是用于Debian和Ubuntu服务器的初始安装和配置的一组脚本,以用作虚拟主机

    TAN 这是用于Debian或Ubuntu服务器的初始安装和配置的脚本集,以用作Web托管。要求没有预装软件的服务器Debian 7或Debian 8 要么Ubuntu服务器16 可以上网。 最小RAM 256 MB 。 推荐的RAM 1 GB或更多。 软件安装的...

    ASCOOS Web Server-开源

    AWS是适用于所有Web开发人员和Web设计人员的Web服务器的特殊版本,它基于Apache,NGINX,Subversion for Apache,Perl,PHP和MySQL的多个版本,PostgreSQL,MongoDB,SQLite,Filezilla FTP Server,memcached,...

    PHP集成环境CoreAMP(Windows下完全绿色版)

    包含Apache 2.2.16、Mysql 5.1.51、PHP 5.2.14(ZendDebugger、ZendOptimizer)、PHP 5.3.3(XDebug、XCache)、Nginx 0.8.52、memcached 1.4.5、Subversion 1.6.12、PHPUnit 3.4.15、phpDocumentor 1.4.3、...

    捕鱼java源码-professional:关于我的专业信息

    网络服务器:Apache、Nginx 应用服务器:Tomcat、WebLogic 管理程序管理:VMware ESXi、VirtualBox 系统编排:Chef、Puppet、Ansible 版本管理工具:Git、Subversion 监控:Sensu、Nagios、New Relic、AppDynamics ...

Global site tag (gtag.js) - Google Analytics