|
CentOS搭建Nginx+Subversion环境
因为某种原因我们需要用Nginx作为Subversion的http前端,但目前没有现成的Nginx+Subversion搭配方式。
而Subversion提供Apache的http处理模块。现在我们通过nginx反向代理给Apache的方式来实现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 workchown -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.soLoadModule 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反向代理
下载nginx
wget http://nginx.org/download/nginx-0.8.55.tar.gztar -xzvf nginx-0.8.55.tar.gzcd 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_modulemakemake installcd /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最后
访问http://svn.test.com/svn/work 即访问svn库
http://www.opstool.com/article/282
CentOS搭建Nginx+Subversion环境
|
|