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

I'm trying to set up a basic authentication with Nginx.

My server configuration look like that:

server {
  listen 80;
  server_name DOMAIN;
  root /var/www/web-front-dev/current/public;
  error_log /var/log/nginx/web-front-dev-error.log;
  access_log /var/log/nginx/web-front-dev-access.log;
  passenger_enabled on;
  client_max_body_size 100M;

  location / {
    passenger_enabled on;

    auth_basic "Restricted";
    auth_basic_user_file /var/www/web-front-dev/shared/simple_authentication_user_file;

The content of simple_authentication_user_file is simply: a:b

After having restarted everything, I keep having an error while trying to logging to my domain (I checked that I enter 'b' correctly hmm hmm):

2011/08/10 16:10:13 [error] 26768#0: *1 user "a": password mismatch, client: IP, server: DOMAIN, request: "GET / HTTP/1.1", host: "DOMAIN"

I even put a chmod 777 to simple_authentication_user_file to see if it could be a problem without any success.

Could anyone suggest me something to check?

share|improve this question
up vote 2 down vote accepted

Are you trying to use a plain text password? The document states that you must use an encrypted one:

Passwords must be encoded by function crypt(3).

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.