Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Server Operation

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 2nd September 2010, 09:47
scars230 scars230 is offline
Junior Member
 
Join Date: Aug 2010
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Exclamation how to deny directory by ip address in nginx

Hi
Suppose i got /var/www/website/secretfiles

I want secretfiles to be accessed by only a few specific static ip addresses

How do i achieve this ?
This was possible in Apache2 using .htaccess files.
But i really dont know how to get it going with nginx.

Please advice.

Thank You
Reply With Quote
Sponsored Links
  #2  
Old 2nd September 2010, 10:04
Mark_NL Mark_NL is offline
Senior Member
 
Join Date: Sep 2008
Location: The Netherlands
Posts: 912
Thanks: 12
Thanked 100 Times in 96 Posts
Default

Code:
location <dir> {
  allow 1.2.3.4/32; # To give one ip access
  allow 192.168.1.0/24; # To give a whole network access
  deny all;
}
Reply With Quote
  #3  
Old 2nd September 2010, 10:06
scars230 scars230 is offline
Junior Member
 
Join Date: Aug 2010
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i put these in nginx.conf ?
using debian lenny
Reply With Quote
  #4  
Old 2nd September 2010, 10:15
Mark_NL Mark_NL is offline
Senior Member
 
Join Date: Sep 2008
Location: The Netherlands
Posts: 912
Thanks: 12
Thanked 100 Times in 96 Posts
Default

/etc/nginx/sites-enabled/default ?
Reply With Quote
  #5  
Old 2nd September 2010, 10:23
scars230 scars230 is offline
Junior Member
 
Join Date: Aug 2010
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Okay thanks :-)
Reply With Quote
  #6  
Old 2nd September 2010, 10:41
scars230 scars230 is offline
Junior Member
 
Join Date: Aug 2010
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
 
Default

http://www.cyberciti.biz/faq/linux-u...control-howto/

I can do it in nginx.conf

thanks for telling me the right words
i searched with location deny nginx
and got to the correct page
thank you
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Webmin upgrade lishaw1968 Installation/Configuration 15 26th August 2010 15:23
can't help ispconfig to install please help steve51184 Installation/Configuration 17 20th February 2009 10:37
Could not configure PHP ? Hacken Installation/Configuration 5 21st March 2007 08:58
Debian3.1 | PHP Binary planet_fox Installation/Configuration 2 26th September 2006 00:52
Install Error on Debian 3.1 planet_fox Installation/Configuration 4 25th June 2006 17:03


All times are GMT +2. The time now is 16:39.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.