# Configure auth\_basic with Nginx and Passenger

**URL:** <https://www.ruby-forum.com/t/configure-auth-basic-with-nginx-and-passenger/210625>\
**Category:** NGINX\
**Created:** [August 12, 2011, 10:18am UTC](https://www.ruby-forum.com/t/configure-auth-basic-with-nginx-and-passenger/210625 "2011-08-12T10:18:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [August 12, 2011, 10:18am UTC](https://www.ruby-forum.com/t/configure-auth-basic-with-nginx-and-passenger/210625/1 "2011-08-12T10:18:30Z")

</div>

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?

Posted at Nginx Forum:

> **[Configure auth\_basic with Nginx and Passenger](https://forum.nginx.org/read.php?2,213723,213723#msg-213723)**
>
> 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

---

<div class="post-metadata">

**Author:** ![vincentp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/f19dbf/32.png) [@vincentp](https://www.ruby-forum.com/u/vincentp)\
**Post date:** [August 12, 2011, 11:17am UTC](https://www.ruby-forum.com/t/configure-auth-basic-with-nginx-and-passenger/210625/2 "2011-08-12T11:17:56Z")

</div>

Hello!

On Fri, Aug 12, 2011 at 04:18:12AM -0400, vincentp wrote:

> I’m trying to set up a basic authentication with Nginx.
> 
> My server configuration look like that:

[…]

> The content of simple\_authentication\_user\_file is simply:  
> a:b

If you want to use plain text passwords, use

a:{PLAIN}b

instead (works in nginx 1.0.3+).

By default passwords are expected to be encrypted by crypt(3), see  
[1]. The only exception is Windows version where is no crypt()  
and passwords are treated as plain text by default (you may want  
to use $apr1$ aka Apache md5 passwords on Windows as supported in  
1.0.3+ for maximum security).

[1] [GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com · GitHub](http://wiki.nginx.org/HttpAuthBasicModule#auth_basic_user_file)

Maxim D.

---

<div class="post-metadata">

**Author:** ![vincentp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/f19dbf/32.png) [@vincentp](https://www.ruby-forum.com/u/vincentp)\
**Post date:** [August 12, 2011, 6:04pm UTC](https://www.ruby-forum.com/t/configure-auth-basic-with-nginx-and-passenger/210625/3 "2011-08-12T18:04:25Z")

</div>

Thanks for your answer!

I haven’t read the small caracteres at the bottom of the page properly  
😉

Vincent

Posted at Nginx Forum:

> **[Re: Configure auth\_basic with Nginx and Passenger](https://forum.nginx.org/read.php?2,213723,213742#msg-213742)**
>
> 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
