配置 apache + svn

2010-08-30

使用SVN对服务器配置文件进行集中管理 主要使用 SVN+HTTPS 分发服务器配置文件

安装openssl:

wget http://www.openssl.org/source/openssl-0.9.8m.tar.gz
tar xzvf openssl-0.9.8m.tar.gz
cd openssl-0.9.8m
./config --prefix=/opt/openssl --shared
make && make install

安装apache:

wget http://archive.apache.org/dist/httpd/httpd-2.2.14.tar.bz2
tar xjvf httpd-2.2.14.tar.bz2
cd httpd-2.2.14
"./configure" \
"--prefix=/opt/apache2" \
"--with-included-apr" \
"--enable-so" \
"--with-mpm=worker" \
"--enable-mods-shared=all" \
"--enable-deflate=shared" \
"--enable-expires=shared" \
"--enable-rewrite" \
"--enable-authn-anon" \
"--enable-ssl" \
"--with-ssl=/opt/openssl" \
"--disable-userdir" \
"--disable-authn-file" \
"--disable-authn-dbm" \
make && make install

安装subversion:

wget http://subversion.tigris.org/downloads/subversion-1.5.7.tar.bz2
tar xjvf subversion-1.5.7.tar.bz2
cd subversion-1.5.7
./configure --prefix=/opt/subversion/ \
--with-apxs=/opt/apache2/bin/apxs \
--with-apr=/opt/apache2/bin/ \
--with-apr-util=/opt/apache2/bin/ \
--enable-shared
make && make install

建立 SVN root 目录:

svnadmin create /opt/case/repos

导入apache 配置文件:

svn import /opt/apache2/conf file://opt/case/repos/apache_conf -m "import apache_conf"

利用openssl 生成证书:

cd /opt/apache/conf
/opt/openssl/bin/openssl genrsa -des3 -out server.key 2048
/opt/openssl/bin/openssl req -new -key server.key -out server.csr
/opt/openssl/bin/openssl x509 -req -in server.csr -signkey server.key -out server.cert

配置APACHE:

导入证书

vi extra/httpd-ssl.conf
LoadModule ssl_module modules/mod_ssl.so
Include conf/extra/httpd-ssl.conf
SSLCertificateFile /opt/app/apache2/conf/server.cert
SSLCertificateKeyFile /opt/app/apache2/conf/server.key

vi http.conf
 DAV svn
 SVNlistParentPath on
 SSLRequireSSL
 SVNPath /opt/case/repos/

启动Apache:

/opt/apache/bin/apachectl -k start

FAQ: error: /usr/bin/ld: cannot find -lexpat 表示缺少expat的库。 ubuntu下: sudo apt- get install libexpat1-dev&&