Docker里面的Apache2重写条件限制为3个参数

我想禁用一些具体的推荐人来吸引stream量到我的网站。 因此我在Apache2(v2.4)config /etc/apache2/conf-enabled/block_referer.conf添加了以下内容:

 RewriteEngine On RewriteCond "%{HTTP_REFERER}" "(site1.com|site2.com|site3.com|site4.com)" [NC] RewriteRule .* - [F] 

apache2ctl -t在语法上给出了它的确定,所以当我重新加载configuration时,它阻止访问前三个引用者:

 $ for i in 1 2 3; do echo "site $i:" && curl -e site$i.com mysite.com; done site 1: HTTP/1.1 403 Forbidden Date: Wed, 18 Oct 2017 10:25:22 GMT Server: Apache/2.4.10 (Debian) Content-Type: text/html; charset=iso-8859-1 site 2: HTTP/1.1 403 Forbidden Date: Wed, 18 Oct 2017 10:25:22 GMT Server: Apache/2.4.10 (Debian) Content-Type: text/html; charset=iso-8859-1 site 3: HTTP/1.1 403 Forbidden Date: Wed, 18 Oct 2017 10:25:22 GMT Server: Apache/2.4.10 (Debian) Content-Type: text/html; charset=iso-8859-1 

但是对于第四个网站( site4.com ),它给出了:

 $ curl -e site4.com mysite.com HTTP/1.1 200 OK Date: Wed, 18 Oct 2017 10:25:22 GMT Server: Apache/2.4.10 (Debian) Cache-Control: no-cache Content-Type: text/html; charset=iso-8859-1 

另外值得一提的是,我正在Docker容器中运行这个站点。 我得到它没有docker容器工作。