安裝Centos7.0
php
最小版安裝時,注意自行生成ifcfg-eth0,並設置DNS,主機名。
html
幾個地址:
nginx
/etc/sysconfig/network-scripts
git
/etc/sysconfig/network
github
/etc/resolv.conf
ide
Yum安裝net-tools,CentOS7默認沒有ifconfig。
wordpress
關閉防火牆,CentOS默認不是iptables是Firewall:
post
systemctl stop firewalld.service #中止firewall
測試
systemctl disable firewalld.service #禁止firewall開機啓動
ui
安裝Nginx,使用淘寶(http://tengine.taobao.org/)的tengine
安裝方法參考我以前的博客http://noc.lzit.edu.cn/wordpress/?p=1392或者http://www.javashuo.com/article/p-eobabnpf-ny.html
與以前不一樣的是須要在編譯時加入ldap認證的支持。
2.1 先安裝gcc、ldap-devel、git等必備的軟件,用yum命令。
2.2 下載ldap支持文件。
git clone https://github.com/kvspb/nginx-auth-ldap.git
./configure –add-module=./
nginx-auth-ldap
2.5 啓動nginx,這點與CentOS6上就不一樣了。
先建立服務文件nginx.service。
位置:/usr/lib/systemd/system/nginx.service
內容:
而後,不管是否修改該服務文件,只要打開,就須要從新導入,使用以下命令:
systemctl daemon-reload
最後用以下命令啓停及添加服務。
systemctl start nginx.service #啓動
systemctl stop nginx.service #中止
systemctl status nginx.service #查看狀態
systemctl enable nginx.service #開機啓動
ps –ef | prep nginx #查看進程
kill –s 9 進程號 #殺死進程
配置Nginx的反向代理支持LDAP Auth
ldap_server test {
url ldap://210.26.*.*:389/ou=*,dc=lzptc?uid?sub?(objectClass=inetOrgPerson);
binddn 「******」;
binddn_passwd 「*********」;
group_attribute inetOrgPerson;
group_attribute_is_dn on;
require valid_user;
}
upstream lzitjpkc {
server 210.26.16.44 max_fails=1 weight=1 fail_timeout=1;
}
server {
server_name jpkc.lzit.edu.cn;
listen 80;
charset utf-8;
location / {
charset gbk;
auth_ldap 「Forbidden」;
auth_ldap_servers test;
proxy_pass http://lzitjpkc;
}
}
配置完成,保存配置,從新啓動nginx。
測試:
輸入LDAP服務中預存的帳號密碼,登陸成功!
如下是資料。
認證順序:
資料以下:
Syntax: |
satisfy all | any; |
Default: |
satisfy all; |
Context: |
http, server, location |
Allows access if all (all) or at least one (any) of the ngx_http_access_module,ngx_http_auth_basic_module, ngx_http_auth_request_module, or ngx_http_auth_jwt_module modules allow access.
Example:
location / {
satisfy any;
allow 192.168.1.0/32;
deny all;
auth_basic "closed site";
auth_basic_user_file conf/htpasswd;
}
這篇文章發佈於 2017年11月16日,星期四,12:15 下午,歸類於 LDAP。 您能夠跟蹤這篇文章的評論經過 RSS 2.0 feed。 您能夠留下評論,或者從您的站點trackback。