限制访问 apache 2.4 目录但允许某些文件

Restrict access to apache 2.4 directory but allow certain files

我有一个 apache 2.4 服务器,它托管 2 个应用程序。其中一个可以免费访问互联网,另一个仅限于某些 IP。所以在我的 /etc/apache2.conf 文件中我有以下内容:

<Directory /var/www/>
   Options FollowSymLinks
   AllowOverride None
   Require all granted
</Directory>

<Directory /var/other/>
   Options FollowSymLinks
   AllowOverride None
   Require ip [ip]
</Directory>

这工作正常,当我尝试访问从 /var/other 提供的任何页面时,我收到 403 禁止,除非我在正确的 IP 上。但是,我现在想让 /var/other/ 目录中的某些页面可以不受 IP 限制地自由访问。我已经尝试了各种组合,例如下面的组合,它有一个嵌套的 标记来授予对特定文件的所有访问权限,但似乎不起作用。

<Directory /var/www/>
   Options FollowSymLinks
   AllowOverride None
   Require all granted
</Directory>

<Directory /var/other/>
   Options FollowSymLinks
   AllowOverride None
   Require ip [ip]
   <Files "/var/other/page.php">
      Require all granted
   </Files>
</Directory>

我试过将 标记放在 "Require ip [ip]" 之前以及 标记前后,但似乎也不起作用。有谁知道这是否可能以及我将如何实施它?

你不应该在文件部分有目录,只有文件名:

   <Files "page.php">