nginxinc / nginx-ldap-auth

Example of LDAP authentication using ngx_http_auth_request_module
BSD 2-Clause "Simplified" License
681 stars 202 forks source link

500 Internal Server Error #46

Closed Howard-Chang closed 6 years ago

Howard-Chang commented 6 years ago

Hi, I follow this reference step by step: https://www.nginx.com/blog/nginx-plus-authenticate-users/ But when I use a web browser to access http://localhost:8081. image Is there something wrong in my nginx.conf? nginx.conf:

error_log logs/error.log debug;
worker_processes  4;
worker_rlimit_nofile 65535;
events {
worker_connections 10240;
}
http {
    proxy_cache_path cache/  keys_zone=auth_cache:10m;
    upstream backend {
        server 127.0.0.1:9000;
    }
    server {
        listen 8081;
        location / {
            auth_request /auth-proxy;
            error_page 401 =200 /login;

            proxy_pass http://backend/;
        }
        location /login {
            proxy_pass http://backend/login;
            proxy_set_header X-Target $request_uri;
        }
        location = /auth-proxy {
            internal;
            proxy_pass http://127.0.0.1:8888;
            proxy_pass_request_body off;
            proxy_set_header Content-Length "";
            proxy_cache auth_cache;
            proxy_cache_valid 200 10m;
            proxy_cache_key "$http_authorization$cookie_nginxauth";
            proxy_set_header X-Ldap-URL      "ldap://localhost/dc=xinhua,dc=org?uid?sub?(objectClass=posixAccount)";
            proxy_set_header X-Ldap-BaseDN   "cn=secretary,ou=group,dc=xinhua,dc=org";
            proxy_set_header X-Ldap-BindDN   "cn=Manager,dc=xinhua,dc=org";
            proxy_set_header X-Ldap-BindPass "mypassword";
            proxy_set_header X-CookieName "nginxauth";
            proxy_set_header Cookie nginxauth=$cookie_nginxauth;

        }
    }
}

image

I didn't modified nginx-ldap-auth-daemon-rh-ctl.sh and python backend-sample-app.py. thank you in advance!

Howard-Chang commented 6 years ago

sorry I found the error is that I didn't run nginx-ldap-auth-daemon.py