Auth user with postgresql
Giuseppe Tofoni
gt0057 at gmail.com
Fri Feb 17 12:39:40 UTC 2012
Hi list
I am a nginx newbie.
Nginx does not ask user and password with the following configuration:
.......
upstream database
{
postgres_server 127.0.0.1 dbname=dbnginx user=nginx password=secret;
}
server
{
listen 80;
server_name localhost;
index index.htm index.html;
location =/t1
{
internal;
postgres_escape $user $remote_user;
postgres_escape $pass $remote_passwd;
postgres_pass database;
postgres_query "SELECT user FROM usertable WHERE
user=$user AND pwd=$pass";
postgres_rewrite no_rows 403;
postgres_output none;
}
location /test //don't request window for user and password
{
auth_basic "folder test1";
auth_request /t1;
}
location /test2 //o.k. request window for user and password
{
auth_basic "folder Test2";
auth_basic_user_file /web/test2/.passwd;
}
-----------
I did several searches on google but found nothing.
Where is the mistake?
Thanks for the help
Giuseppe
P.S: the database connection is ok and password is stored in MD5
follow my compilation config
./configure \
--prefix=/usr/local/nginx \
--sbin-path=/usr/local/nginx/sbin/nginx \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--pid-path=/var/run/nginx/nginx.pid \
--lock-path=/var/lock/nginx.lock \
--http-uwsgi-temp-path=/var/tmp/nginx \
--http-scgi-temp-path=/var/tmp/nginx \
--user=nobody \
--group=nobody \
--with-ipv6 \
--with-http_dav_module \
--with-http_ssl_module \
--with-http_flv_module \
--with-http_gzip_static_module \
--http-log-path=/var/log/nginx/access.log \
--http-client-body-temp-path=/var/tmp/nginx/client/ \
--http-proxy-temp-path=/var/tmp/nginx/proxy/ \
--http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ \
--add-module=/home/mercurio/nginx/ngx_http_auth_request_module-a29d74804ff1 \
--add-module=/home/mercurio/nginx/FRiCKLE-ngx_coolkit-cb99a0f \
--add-module=/home/mercurio/nginx/agentzh-nginx-eval-module-09d7728 \
--add-module=/home/mercurio/nginx/ngx_postgres-0.9
More information about the nginx
mailing list