Newbie questions about nginx (moving from apache)

pk899 nginx-forum at nginx.us
Sat May 28 18:28:52 MSD 2011


Thomas Love Wrote:
-------------------------------------------------------


> > 1. how should i block remote_addr based on IP in
> a certain external
> > file?
> >
> 
> It's in your link: include /etc/nginx/block.conf;


Not correct. The "block.conf" as that guy mentions is only a collection
of rules. 

I am asking if I can have a file that is full of host names or IPs, say
"blacklist.conf". Then, I want to do something like this: 


if ($request_uri ~* ("/blacklist.conf") ) {
  return 403;
}

if ($remote_addr ~* ("/blacklist.conf") ) {
  return 403;
}


This way I can keep easily adding or removing IPs/hosts from my
blacklist file instead of editing the nginx.conf file every time. 

Thanks.

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,201449,201796#msg-201796




More information about the nginx mailing list