lighttpd限制IP访问指定URL

十一月 11th, 2009 Posted in Lighttpd | 阅读次数: 487 次

制作:高进波
时间:2009-09-24

WEB服务器
lighttpd

1.编辑配置文件
vi /etc/lighttpd/lighttpd.conf
#example
$HTTP["host"] == "gaojinbo.com" {
status.status-url = "/server-status"
server.name = "gaojinbo.com"
server.document-root = "/www/www.gaojinbo.com"
$HTTP["remoteip"] !~ "119.107.106|129.145.100.138" {
    $HTTP["url"] =~ "^/server-status" {
      url.access-deny = ( "" )
    }
}
}

 

2.重启服务
/etc/init.d/lighttpd restart

完成!

 

附:
Task: Match on the remote IP

For example block access to http://theos.in/stats/ url if IP address is NOT 192.168.1.5 and 192.168.1.10 (restrict access to these 2 IPs only):

Open /etc/lighttpd/lighttpd.conf file
# vi /etc/lighttpd/lighttpd.conf
Append following configuration directive:

$HTTP["remoteip"] !~ "200.19.1.5|210.45.2.7" {
    $HTTP["url"] =~ "^/stats/" {
      url.access-deny = ( "" )
    }
}

Save and restart lighttpd:
# /etc/init.d/lighttpd restart

相关日志:

Tags:

2 Responses to “lighttpd限制IP访问指定URL”

  1. Stop Panic Attacks Says:

    Some New Sites I Like…

    [...]below you’ll find the link to some websites that I think you should go and see http://www.panicattackstreatmentcure.net/links/ some are related to my site and others are unrelated but definitely worth visiting[...]…


  2. hotels in amsterdam Says:

    You should check this out……

    [...] Wonderful story, reckoned we could combine a few unrelated data, nevertheless really worth taking a look, whoa did one learn about Mid East has got more problerms as well [...]………


留下您的脚印