V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
mhtt
V2EX  ›  Apache

apache2 禁止 ip 访问和别人跳转的设置

  •  
  •   mhtt · 2016-01-31 09:59:22 +08:00 · 1908 次点击
    这是一个创建于 3012 天前的主题,其中的信息可能已经有所发展或是发生改变。

    在 apache2 的 site-available 中,有多个配置文件比如是 1.conf 2.conf 3.conf 访问不同的网站,创建一个新文件 4.conf 用来禁止 ip 访问和别人跳转,设置如下

    <VirtualHost *:80>
    ServerName 123.123.123.123
    ServerAdmin [email protected]
    <Location />
    Order Allow,Deny
    Deny from all
    </Location>
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    </VirtualHost>

    做了这一样的配置,但已久可以通过 ip 访问,访问的是 1.conf 这个配置里面的网站,如果我把 4.conf 改成 0.conf ,只要禁止 ip 访问的文件放在第一位,那么就可以禁止 ip 访问了,如果在不修改禁止访问的文件名字到第一位的话,还有其他办法禁止 ip 访问吗?

    3 条回复    2016-01-31 10:40:43 +08:00
    vibbow
        1
    vibbow  
       2016-01-31 10:32:54 +08:00 via Android
    没有
    vibbow
        2
    vibbow  
       2016-01-31 10:34:02 +08:00 via Android
    这就是为什么默认配置文件要叫
    000-default
    就是为了保证优先加载
    rainy3636
        3
    rainy3636  
       2016-01-31 10:40:43 +08:00 via Android
    换 nginx
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3501 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 04:22 · PVG 12:22 · LAX 21:22 · JFK 00:22
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.