我编辑了我的 apache2.conf(在 Ubuntu 上)以限制除了一个 IP 之外的所有访问,但我仍然可以从其他 IP 访问。下面是我的配置:
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<Directory /usr/share>
AllowOverride None
Require ip x.x.x.x
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require ip x.x.x.x
</Directory>
Run Code Online (Sandbox Code Playgroud)
authz_core 模块已加载,有什么问题吗?谢谢。
Apache 2.4 的 IP 地址访问限制示例:
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
<IfModule mod_authz_core.c>
<RequireAny>
Require ip 127.0.0.1
Require ip ::1
Require ip x.x.x.x
</RequireAny>
</IfModule>
</Directory>
Run Code Online (Sandbox Code Playgroud)
不要忘记通过运行以下命令重新启动 apache 服务:
service httpd restart
Run Code Online (Sandbox Code Playgroud)
directory /出于安全原因也不要使用。
| 归档时间: |
|
| 查看次数: |
11592 次 |
| 最近记录: |