How to protect a folder by IP address in Nginx

June 20th, 2009

To protect a folder by IP address in nginx is fairly simple, see the example below that demonstrates only allowing access to the /protected folder for people in the 192.168.0.* network.

server {
  ....
  location /protected {
    allow 192.168.0.0/24;
    deny all;
  }
  ...
}

Categories: nginx

Tags: , Leave a comment

Like This Post?

Subscribe for more...

1 Comment

  1. Mary

    Pretty cool post. I just stumbled upon your site and wanted to say
    that I’ve really enjoyed reading your posts. In any case
    I’ll be subscribing to your feed and I hope you post again soon!

Feed

http://www.mendable.com / How to protect a folder by IP address in Nginx