debian nginx ,重定向、 账户认证使用ldap

nginx
重定向

server {
	listen 127.0.0.1:1001;
	root /var/www/html;
	index index.html;
	rewrite ^/(.*)$ http://IP/$1 permanent;
	 }

账号密码登录

1 htpasswd

		server {
		listen 127.0.0.1:1001;
		root /var/www/html;
		index index.html;
		location / {
		auth_basic "Please input username and password.";#提示信息 
		auth_basic_user_file /test/htpasswd;}#账户密码
		 }
	 #生成账户密码
 htpasswd -cb /test/htpasswd ceshi 123456
2 ldap
/etc/nginx/conf.d/proxy.conf
ldap_server xxx-ldap {
url ldap://ldap服务器ip:port/DC=xxx,DC=com?cn?sub?(objectClass=person);
binddn "cn=xxx,dc=xxx,dc=xxx";
binddn_passwd "binddn密码";
group_attribute uniquemember;
group_attribute_is_dn on;
require valid_user;
}
server {
  listen       80;
  server_name  localhost;
  location /status {
  stub_status on;
  auth_ldap "Forbidden";
  auth_ldap_servers xxx-ldap;
}

借鉴:

		https://www.jianshu.com/p/bf0f8549352c
		https://blog.csdn.net/h330531987/article/details/79889416
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值