阿帕奇 - 限制为IP不工作 [英] Apache - Restrict to IP not working

查看:141
本文介绍了阿帕奇 - 限制为IP不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个子域名,我只希望访问内部;我试图通过编辑该域的虚拟主机块来实现这一点在Apache中。任何人都可以看到我要去哪里错了吗?请注意,我的内网IP地址这里有192.168.10.xxx。我的code是如下:

 <虚拟主机*:80>
  服务器名test.example.co.uk
  的DocumentRoot的/ var / WWW /测试
  错误日志/var/log/apache2/error_test_co_uk.log
  LOGLEVEL警告
  的CustomLog /var/log/apache2/access_test_co_uk.log结合
  <目录/ var / WWW /试验>
    为了允许,拒绝
    从允许192.168.10.0/24
    从127允许
  < /目录>
< /虚拟主机>

感谢


解决方案

您错过了所有行拒绝?哦,用错了订单

引述 mod_access文档


  

[...] apache.org域中所有主机都允许访问;所有其他主机都被拒绝访问。

 订单拒绝,允许
所有拒绝
从apache.org允许


I've a subdomain that I only want to be accessible internally; I'm trying to achieve this in Apache by editing the VirtualHost block for that domain. Can anybody see where I'm going wrong? Note, my internal IP address here are 192.168.10.xxx. My code is as follows:

<VirtualHost *:80>
  ServerName test.example.co.uk
  DocumentRoot /var/www/test
  ErrorLog /var/log/apache2/error_test_co_uk.log
  LogLevel warn
  CustomLog /var/log/apache2/access_test_co_uk.log combined
  <Directory /var/www/test>
    Order allow,deny
    Allow from 192.168.10.0/24
    Allow from 127
  </Directory>
</VirtualHost>

Thanks

解决方案

You're missing the Deny from all line? Oh, and using the wrong order.

Quoting the mod_access docs:

[...] all hosts in the apache.org domain are allowed access; all other hosts are denied access.

Order Deny,Allow
Deny from all
Allow from apache.org

这篇关于阿帕奇 - 限制为IP不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆