因为某种原因我们需要用Nginx作为Subversion的http前端,但目前没有现成的Nginx+Subversion搭配方式。 构建Apache+Subversion的环境 安装Apache yum install -y httpd 安装Subversion yum install -y subversion 安装Apache SVN模块 yum install -y mod_dav_svn 建立SVN库 mkdir -p /home/svn/ cd /home/svn/ svnadmin create work chown -R apache.apache work 添加Subversion账号 htpasswd -c /home/svn/work/conf/passwdfile test 修改/etc/httpd/conf.d/subversion.conf,内容如下 LoadModule dav_svn_module modules/mod_dav_svn.so LoadModule authz_svn_module modules/mod_authz_svn.so <Location /svn/work> DAV svn SVNPath /home/svn/work AuthType Basic AuthName "Authorization Realm" AuthUserFile /home/svn/work/conf/passwdfile AuthzSVNAccessFile /home/svn/work/conf/authz Require valid-user </Location> 启动httpd /etc/init.d/httpd start
使用Nginx反向代理 wget http://nginx.org/download/nginx-0.8.55.tar.gz tar -xzvf nginx-0.8.55.tar.gz cd nginx-0.8.55 添加nginx账号 useradd -s /bin/false nginx 编译安装nginx ./configure --prefix=/opt/nginx-0.8.55 \ --with-http_stub_status_module \ --with-http_gzip_static_module make make install cd /opt && ln -sf nginx-0.8.55 nginx && cd - 配置Nginx反向代理,修改/opt/nginx/conf/nginx.conf server { listen 80; server_name svn.test.com; location /svn/work { proxy_pass http://127.0.0.1/svn/work; } location / { return 404; } } 启动nginx /opt/nginx/sbin/nginx
最后 转载请保留固定链接: https://linuxeye.com/configuration/2133.html |