How to enable Active Directory authentication for Nwinx ?

Nwinx has built-in support for LDAP authentication allowing you to use AD authentication. 

Follow steps below:

  • Create a dedicated AD service account for LDAP queries (say ldapreq, domain example.local)
  • Start a text editor capable of editing a text file with Unix line endings (Wordpad or Notepad++ for example)
  • Edit file <Nwinx installation directory>\etc\nginx\nginx.conf
http {
....
ldap_server DCGC1 {
    url ldap://192.168.0.1:3268/DC=example,DC=local?sAMAccountName?sub?(objectClass=person);
    binddn "CN=xxxxx,CN=xxxxx,DC=example,DC=local";
    binddn_passwd password;
    group_attribute uniquemember;
    group_attribute_is_dn on;
    require valid_user;
}
 
ldap_server DCGC2 {
    url ldap://192.168.0.2:3268/DC=example,DC=local?sAMAccountName?sub?(objectClass=person);
    binddn "CN=xxxxx,CN=xxxxx,DC=example,DC=local";
    binddn_passwd password;
    group_attribute uniquemember;
    group_attribute_is_dn on;
    require valid_user;
}
  • Replace every occurence of
auth_basic "Restricted";
auth_basic_user_file htpasswd;
 
by
 
auth_ldap "Restricted";
auth_ldap_servers DCGC1,DCGC2;
 
NB! if you want basic authentication still available, you can simply add the ldap directives above instead of replacement. It is also possible to use groups. Check example configuration link below for more details.
 
  • Restart NginxServer service
 
Useful links: