Setting up HTTP Basic Authorisation

Igor Sysoev is at rambler-co.ru
Wed Dec 6 14:16:12 MSK 2006


On Wed, 6 Dec 2006, T Gillett wrote:

> I am trying to set up HTTP Basic Authentication for nginx on my NSLU2 running
> Unslung 6.8.
>
> To test I have added the auth-basic lines to the nginx.conf file to control
> access to php files as follows:
>
> #proxy php-fcgi
>        location ~ \.php$ {
>            fastcgi_pass   127.0.0.1:9009;
>            fastcgi_index  index.php;
>            fastcgi_param  SCRIPT_FILENAME  /opt/share/www/php/$fastcgi_script_name;
>            fastcgi_param  QUERY_STRING     $query_string;
>            fastcgi_param  REQUEST_METHOD   $request_method;
>            fastcgi_param  CONTENT_TYPE     $content_type;
>            fastcgi_param  CONTENT_LENGTH   $content_length;
> 	     auth_basic "Restricted";
>            auth_basic_user_file conf/htpasswd;
>
> With the auth-basic lines commented out, I can access the php pages OK.
> With the lines in place, I get the login dialog box as expected, but when I
> login, all that happens is that the login box is refreshed.
>
> Two entries are created in the host.access.log showing the attempted access.
> There is no entry in the error.log
>
> I think I am just missing some basic step in setting this up.
>
> Is the htpassword file correct?
> Is the encryption of the password correct?

What does
perl -le 'print crypt("test", "cg")'
show ?

> Any suggestions / help appreciated

> ************************************************
> The htpassword file for the user account ЪЪtestЪЪ is as follows:
> 	test:cgsk91HyOZHGE
> (the password is ЪЪtestЪЪ)
>
> The entries in the host.access.log is as follows:
>
> 192.168.1.25 - - [06/Dec/2006:20:27:32 +1000] GET /hello.php HTTP/1.1
> Status"401" Bytes195 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
> rv:1.8.0.8) Gecko/20061025 Firefox/1.5.0.8" "-"
>
> 192.168.1.25 - test [06/Dec/2006:20:27:40 +1000] GET /hello.php HTTP/1.1
> Status"401" Bytes195 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
> rv:1.8.0.8) Gecko/20061025 Firefox/1.5.0.8" "-"

Could you make a debug log ?


Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list