Auth_basic 500 Internal Server Error

Hi, guys!

I am attempting to secure one subdirectory on the server with
ngx_http_auth_basic_module. Unfortunately, without success.

In log file error:

2013/06/24 22:03:05 [crit] 34189#0: *1 open()
“/usr/local/etc/nginx/authpw” failed (13: Permission denied), client:
111.222.251.165, server: server.com.ua, request: “GET /private/
HTTP/1.1”, host: “server.com.ua”

Part of nginx.conf:
location ^~ /private {
auth_basic “Closed area, sorry…”;
auth_basic_user_file /usr/local/etc/nginx/authpw;

ls -lo ./authpw

-r–r----- 1 root www - 50 24 чер 21:58 ./authpw

cat ./authpw

#coments
vv:$apr1$NhsePrJ/$MHMNGRoELdDfzcE/kGJpz1

What I have missed?

2013/06/24 22:03:05 [crit] 34189#0: *1 open()
“/usr/local/etc/nginx/authpw” failed (13: Permission denied)

ls -lo ./authpw

-r–r----- 1 root www - 50 24 чер 21:58 ./authpw

What I have missed?

The error log kind of explains - the auth file is not readable by nginx
user.

Do you have specified the ‘www’ group in the nginx config (
Core functionality ) ?

rr

— Original message —
From: “Reinis R.” [email protected]
Date: 24 June 2013, 23:00:48

Do you have specified the ‘www’ group in the nginx config (
Core functionality ) ?

Off course,
user www www;
worker_processes 1;

On Tue, 2013-06-25 at 00:20 +0300, wishmaster wrote:

-r–r----- 1 root www - 50 24 чер 21:58 ./authpw
user www www;
worker_processes 1;

The error is extremely specific. Look at permissions of file ( looks ok
), and all parent directories. www ( user and group ) doesn’t have
access to one of them.

You only showed permissions of ./authpw. Can you confirm you were
in /usr/local/etc/nginx at the time?

Steve

Steve H. BSc(Hons) MNZCS

Linkedin: http://www.linkedin.com/in/steveholdoway
Skype: sholdowa

Yeah, Steve! You’re right. Thanks. nginx config dir had rwx for
root:wheel only. Need to sleep :-).

— Original message —
From: “Steve H.” [email protected]
Date: 25 June 2013, 00:25:26