7 配置文件
把文件active.der.crt和active.key拷贝到..\Apache Group\Apache2\conf\ssl
打开文件httpd.cnf,将下面行前的注释去掉:
LoadModule ssl_module modules/mod_ssl.so
打开文件..\Apache Group\Apache2\conf\ssl.cnf,确保以下行是没有注释掉的.
DocumentRoot "../Apache Group/Apache2/htdocs"
ServerName www.active.com:443
ServerAdmin eric.du@active.com
ErrorLog logs/error_log
TransferLog logs/access_log
SSLMutex default
SSLRandomSeed startup builtin
SSLSessionCache none
(SSLSessionCache确保其他行是注释的)
做以下两个更改:
SSLCertificateFile conf/ssl.crt/server.crt
-à SSLCertificateFile conf/ssl/active.der.crt
SSLCertificateKeyFile conf/ssl.key/server.key
--> SSLCertificateKeyFile conf/ssl/active.key
去掉或注释以下两行:
<IfDefine SSL>
</IfDefine>
好了,重启apache,测试访问:https://localhost和https://localhost/svn.
现在我们可以通过http和https两种方式访问.如果我们强制要求使用https或对http自动重定向为https.就需要参考下面:
8 强制SSL和自动重定向
打开httpd.conf,进行配置.
如果只是要求subversion库使用此策略,则就将下面的命令放在<Location /svn>…< Location>中,若是整个apache,则放在<Directory />…</Directory>中.
1) 强制
SSLRequireSSL
2) 自动重定向
RewriteEngine on
RewriteCond %{REMOTE_ADDR} !^172\.31\.224\.[0-9]+$
RewriteCond %{HTTPS} !on [NC]
RewriteRule .* - [F]