配置 Apache 2 以确保安全性



参考本文档 https://httpd.apache.org/docs/2.4/howto/access.html 和 https://httpd.apache.org/docs/2.4/mod/mod_authz_host.html#requiredirectives,指令应该插入哪个文件?例如"需要IP 127.0.0.1" 我说的是 debian 中 apache2 的配置,我希望限制除 127.0.0.1(localhost(之外的所有内容的访问权限。 谢谢

您可以在 VirtualHost 的配置文件中设置要授予访问权限的 IP(默认为/etc/apache2/sites-avaiable/000-default.conf(

好的,我解决了。 输入配置的正确文件是/etc/apache2/apache2.conf 这是配置:

<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
#       Require all granted
Require host localhost
#       Require all denied
</Directory>

最新更新