码迷,mamicode.com
首页 > 其他好文 > 详细

安装Subversion, 并用Nginx代理

时间:2017-08-06 12:34:48      阅读:220      评论:0      收藏:0      [点我收藏+]

标签:pos   代理   compiler   安装   mct   失败   roo   pil   tortoise   

环境:CentOS 7.3.1611


第一步:安装subversion

  1. 安装subversion -> yum -y install subversion;

  2. 创建svn目录 -> mkdir /var/svn, subversion的默认目录, 没有此目录, 启动服务会失败;

  3. 创建仓库 -> svnadmin create /var/svn/repo1;

  4. 修改仓库认证策略文件 -> vi /var/svn/repo1/conf/svnserve.conf, 对anon-access = read、auth-access = write、password-db = passwd、authz-db = authz取消注释;

  5. 添加svn用户 -> vi /var/svn/repo1/conf/passwd, 添加svn = svn;

  6. 用户授权 -> vi /var/svn/repo1/conf/authz, 添加[repo1:/] svn = rw;

  7. 启动服务 -> systemctl start svnserve.service;

  8. windows系统使用TortoiseSVN访问svn://ip/repo1 ,本机访问 -> wget http://127.0.0.1:3690/repo1, 正常访问说明配置已生效;

第二步:安装httpd

  1. 安装httpd -> yum -y install httpd;

  2. 安装httpd的svn模块 -> yum -y install mod_dav_svn;  

  3. 修改配置文件 -> vi /etc/httpd/conf/httpd.conf

    3.1 搜索“LoadModule”, 添加以下两行:

      LoadModule dav_module modules/mod_dav.so

      LoadModule dav_svn_module modules/mod_dav_svn.so

    3.2 在文件结束处添加以下内容: 

      <Location /svn>

        DAV svn

        SVNParentPath /var/svn

        #Authentication: Basic

        AuthName "Subversion repository"

        AuthType Basic

        AuthUserFile /etc/httpd/svn-auth.htpasswd

        #Authorization: Authenticated users only

        <LimitExcept GET PROPFIND OPTIONS REPORT>

          Require valid-user

        </LimitExcept>

      </Location>

  4. 创建svn-auth.htpasswd文件并添加用户laohans -> htpasswd -c -m /etc/httpd/svn-auth.htpasswd laohans;

  5. 将apache用户添加到root组 -> usermod -a -G root apache;

  6. 启动httpd -> systemctl start httpd.service;

  7. 通过浏览器访问 -> http://ip:port/repo1;

  8. 修改httpd端口 -> vi /etc/httpd/conf/httpd.conf, 找到“Listen 80”, 将80修改为81;

  9. 重启httpd -> systemctl restart httpd.service;

第三步:安装nginx

  1. 下载nginx -> wget https://nginx.org/download/nginx-1.12.1.tar.gz;

  2. 解压nginx -> tar -zxvf nginx-1.12.1.tar.gz;

  3. 进入解压后的nginx目录,编译 -> ./configure,

    3.1 会依次出现以下错误提示:

      ./configure: error: C compiler cc is not found;

      ./configure: error: the HTTP rewrite module requires the PCRE library;

      ./configure: error: the HTTP gzip module requires the zlib library;

    3.2 安装依赖库 -> yum -y install gcc pcre-devel zlib-devel;

    3.3 再次编译 -> ./configure, 出现以下内容说明编译成功:

      Configuration summary

        + using system PCRE library

        + OpenSSL library is not used

        + using system zlib library

          nginx path prefix: "/usr/local/nginx"

          nginx binary file: "/usr/local/nginx/sbin/nginx"

          nginx modules path: "/usr/local/nginx/modules"

          nginx configuration prefix: "/usr/local/nginx/conf"

          nginx configuration file: "/usr/local/nginx/conf/nginx.conf"

          nginx pid file: "/usr/local/nginx/logs/nginx.pid"

          nginx error log file: "/usr/local/nginx/logs/error.log"

          nginx http access log file: "/usr/local/nginx/logs/access.log"

          nginx http client request body temporary files: "client_body_temp"

          nginx http proxy temporary files: "proxy_temp"

          nginx http fastcgi temporary files: "fastcgi_temp"

          nginx http uwsgi temporary files: "uwsgi_temp"

          nginx http scgi temporary files: "scgi_temp"

  4. 安装 -> make install;

  5. 让nginx代理httpd -> vi /usr/local/nginx/conf/nginx.conf, 添加以下内容: 

    location /svn {

      proxy_pass http://127.0.0.1:81

    }

  6. 启动nginx -> /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf;

  7. 通过浏览器访问 -> http://ip/svn/repo1;

 

参考文档:https://www.ibm.com/developerworks/cn/java/j-lo-apache-subversion/

安装Subversion, 并用Nginx代理

标签:pos   代理   compiler   安装   mct   失败   roo   pil   tortoise   

原文地址:http://www.cnblogs.com/laohans/p/7294009.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!