nginx subversion apache 설치 설정

8159 단어
nginx 는 현재 subversion 을 지원 하지 않 고 웹 서버 는 nginx 를 선 택 했 기 때문에 apache 통합 subversion 을 설치 한 다음 에 nginx proxy 를 통 해 apache 에 nginx 의 svn 을 실현 할 수 밖 에 없습니다. 
 
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 / apache 2 / 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 [email protected]

<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>

 
암호 파일 만 들 기 davsvn.passwd 
 
sudo htpasswd -c /etc/apache2/dav_svn.passwd root
           
sudo htpasswd  /etc/apache2/dav_svn.passwd isends

인증 파일 만 들 기 davsvn.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), 계 정, 비밀 번 호 는 항목 을 이전 할 수 있 습 니 다.

좋은 웹페이지 즐겨찾기