Skip to content

Commit 68036a7

Browse files
authored
Merge pull request weseek#3 from weseek/divide-ldap-config-to-example
Divide ldap config to example
2 parents b4ccdd9 + 643099a commit 68036a7

File tree

5 files changed

+59
-5
lines changed

5 files changed

+59
-5
lines changed

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,24 @@
33
This is the Git repo of the Docker image for [official nginx](https://registry.hub.docker.com/_/nginx/) bundled with [nginx-auth-ldap](https://github.com/kvspb/nginx-auth-ldap).
44
**Currently, only the mainline-alpine image is maintained.**
55

6-
# Sample Configuration
6+
# How to run with LDAP authentication example
77
Run the below command, and access to http://localhost:8080, you may need credential to open.
88
```
9+
$ git clone https://github.com/weseek/nginx-auth-ldap
10+
$ cd nginx-auth-ldap
911
$ docker run -d -p 127.0.0.1:8080:80 \
12+
-v $(pwd)/mainline/alpine/conf.d.example:/etc/nginx/conf.d \
1013
-e NGINX_AUTH_LDAP_URL=<LDAP URL (ex. ldap://example.com/ou=people,dc=example,dc=com)> \
1114
-e NGINX_AUTH_LDAP_BINDDN=<BIND DN (ex. cn=auth,dc=example,dc=com)> \
1215
-e NGINX_AUTH_LDAP_BINDPW=<password of BIND DN> \
1316
weseek/nginx-auth-ldap:1.13.9-alpine
1417
```
15-
If you use docker-compose, you can use the below example.
18+
If you want to use docker-compose, you can use the below example.
1619
```
20+
$ git clone https://github.com/weseek/nginx-auth-ldap
21+
$ cd nginx-auth-ldap
22+
$ vi docker-compose.yml
23+
(add these lines)
1724
version: '2'
1825
services:
1926
nginx:
@@ -24,4 +31,7 @@ services:
2431
NGINX_AUTH_LDAP_URL: <LDAP URL (ex. ldap://example.com/ou=people,dc=example,dc=com)>
2532
NGINX_AUTH_LDAP_BINDDN: <BIND DN (ex. cn=auth,dc=example,dc=com)>
2633
NGINX_AUTH_LDAP_BINDPW: <password of BIND DN>
34+
volumes:
35+
- ./mainline/alpine/conf.d.example:/etc/nginx/conf.d
36+
$ docker-compose up
2737
```

mainline/alpine/Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,6 @@ RUN GPG_KEYS=B0F4253373F8F6F510D42178520A9993A1C052F8 \
145145
&& ln -sf /dev/stderr /var/log/nginx/error.log
146146

147147
COPY nginx.conf /etc/nginx/nginx.conf
148-
COPY ldap.conf.template /etc/nginx/conf.d/ldap.conf.template
149148
COPY nginx.vh.default.conf /etc/nginx/conf.d/default.conf
150149
COPY nginx-envsubst.sh /usr/bin/nginx-envsubst
151150

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
server {
2+
listen 80;
3+
server_name localhost;
4+
5+
#charset koi8-r;
6+
#access_log /var/log/nginx/host.access.log main;
7+
8+
location / {
9+
auth_ldap "Closed content";
10+
auth_ldap_servers ldap1;
11+
root /usr/share/nginx/html;
12+
index index.html index.htm;
13+
}
14+
15+
#error_page 404 /404.html;
16+
17+
# redirect server error pages to the static page /50x.html
18+
#
19+
error_page 500 502 503 504 /50x.html;
20+
location = /50x.html {
21+
root /usr/share/nginx/html;
22+
}
23+
24+
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
25+
#
26+
#location ~ \.php$ {
27+
# proxy_pass http://127.0.0.1;
28+
#}
29+
30+
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
31+
#
32+
#location ~ \.php$ {
33+
# root html;
34+
# fastcgi_pass 127.0.0.1:9000;
35+
# fastcgi_index index.php;
36+
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
37+
# include fastcgi_params;
38+
#}
39+
40+
# deny access to .htaccess files, if Apache's document root
41+
# concurs with nginx's one
42+
#
43+
#location ~ /\.ht {
44+
# deny all;
45+
#}
46+
}
47+

mainline/alpine/nginx.vh.default.conf

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ server {
66
#access_log /var/log/nginx/host.access.log main;
77

88
location / {
9-
auth_ldap "Closed content";
10-
auth_ldap_servers ldap1;
119
root /usr/share/nginx/html;
1210
index index.html index.htm;
1311
}

0 commit comments

Comments
 (0)