Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In my Nginx setup I would like to password protect some website, except when I access it from my ip at home. How do I set this up?

Also, except for getting access to my home pc, is this safe?

share|improve this question
up vote 8 down vote accepted

After long searching I found it myself.

When satisfy_any is put on "Directive solves access with at least one successful checking, executed by modules HttpAccessModule or HttpAuthBasicModule"

  location / {
    satisfy any;
    deny   all;
    auth_basic            "closed site";
    auth_basic_user_file  /data/www_data/htpasswd;

(satisfy any is the new syntax, satisfy_any threw a warning. The documentation I can't find however)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.