禁止IP访问网站-Nginx

Monday, May 24, 2010

在看错误日志exception_notification邮件的时候,发现有人用IP访问网站,所以想禁止IP访问网站,
在配置中加入下面代码就可以了 !~
禁止IP访问

server{
        listen 80 default; #参数表示这个是默认虚拟主机
        server_name _;
        rewrite ^(.*) http://lxneng.com permanent; #跳转到域名 
        #return 500; #或者返回 500;
}

This entry was tagged Linux and Nginx

comments powered by Disqus

© 2009-2013 lxneng.com. All rights reserved. Powered by Pyramid

go to Top