尝试拒绝除一个域之外的所有连接

Attempt to refuse all connections except one domain

几个小时以来,我一直在尝试在 httpd 配置中阻止除我的域之外的所有连接。 但我无法连接到我自己的域。我刚看到 Forbidden 页面。

<VirtualHost *:80>
ServerName Server-VM
DocumentRoot /var/www/
    SetEnvIf Referer domain\.cc internal
    <FilesMatch "\.(avi|mp4)$">
    Order Deny,Allow
    Deny from all
    Allow from env=internal
   </FilesMatch>
</VirtualHost>

我的Apache版本:2.2.15 我做错了什么?

谢谢!

mod_access_compat 提供的 Allow、Deny 和 Order 指令已弃用,并将在未来的版本中消失。您应该避免使用它们,并避免推荐使用它们的过时教程。

尝试

<FilesMatch "\.(avi|mp4)$">
   Require host domain.cc
</FilesMatch>

更多信息来自 https://httpd.apache.org/docs/2.4/howto/access.html