Apache:如何将虚拟目录限制为本地网络

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/710402/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 17:27:07  来源:igfitidea点击:

Apache: how to limit virtual dir to local network

securityapacheaccess-controlapache-configlan

提问by user86282

On my Apache 2.x server at home, I have a number of virtual directories. I've set up my router so that I can access Apache from the internet. I need to keep one of those virtual dirs (/private) from being accessed outside my home network LAN. So given /private, how do I configure Apache to only serve requests to /private from 192.168.4.x?

在我家里的 Apache 2.x 服务器上,我有许多虚拟目录。我已经设置了我的路由器,以便我可以从 Internet 访问 Apache。我需要防止这些虚拟目录之一 (/private) 在我的家庭网络 LAN 之外被访问。那么给定 /private,我该如何配置 Apache 以只处理来自 192.168.4.x 的 /private 请求?

回答by chaos

<Directory /users/me/private>
    Order deny,allow
    Allow from 192.168.4
    Deny from all
</Directory>