mhtt
V2EX  ›  Apache

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

  •  
  •   mhtt · Jan 31, 2016 · 2495 views
    This topic created in 3781 days ago, the information mentioned may be changed or developed.

    在 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 replies    2016-01-31 10:40:43 +08:00
    vibbow
        1
    vibbow  
       Jan 31, 2016 via Android
    没有
    vibbow
        2
    vibbow  
       Jan 31, 2016 via Android
    这就是为什么默认配置文件要叫
    000-default
    就是为了保证优先加载
    rainy3636
        3
    rainy3636  
       Jan 31, 2016 via Android
    换 nginx
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3598 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 39ms · UTC 04:51 · PVG 12:51 · LAX 21:51 · JFK 00:51
    ♥ Do have faith in what you're doing.