1、安装开发环境

# aptitute update
# aptitude install -y build-essential
# aptitude install -y libldap2-dev openssl libssl-dev

2、升级gcc和glibc(debian7自带的版本太低,编译会报错)

# vim /etc/apt/sources.list
deb http://ftp.debian.org/debian sid main # apt-get update
# apt-get -t sid install libc6 gcc # gcc -v
gcc version 6.4.0 20170724 (Debian 6.4.0-2)

3、下载nginx-auth-ldap模块包

# git clone https://github.com/kvspb/nginx-auth-ldap.git

4、安装lua

# aptitude install -y lua5.1 liblua5.1-0 liblua5.1-0-dev

# lua -v
Lua 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio

5、下载nginx-lua模块包

# wget https://github.com/openresty/lua-nginx-module/archive/v0.10.9rc8.tar.gz
# tar xvf v0.10.9rc8.tar.gz
# mv lua-nginx-module-0.10.9rc8/ lua-nginx-module

6、编译安装tengine

查看帮助

--with-http_lua_module             enable ngx_http_lua_module (will also enable --with-md5 and --with-sha1)
--with-http_lua_module=shared enable ngx_http_lua_module (shared) (will also enable --with-md5 and --with-sha1)
--with-lua-inc=PATH set Lua headers path (where lua.h/lauxlib.h/... are located)
--with-lua-lib=PATH set Lua library path (where liblua.{a,so} are located, only support Lua-5.1.x) --with-http_reqstat_module=shared enable ngx_http_reqstat_module (shared)

下载源码包解压编译

# cd /usr/local/src
# wget http://tengine.taobao.org/download/tengine-2.2.0.tar.gz
# tar xvf tengine-2.2.0.tar.gz
# cd tengine-2.2.0/
# ./configure --prefix=/usr/local/nginx01 --with-http_reqstat_module=shared --add-module=../nginx-auth-ldap --add-module=../lua-nginx-module # make -j 32
# make install

或者把lua模块编译成动态shrared

# ./configure --prefix=/docker/tengine-2.2.0 --with-http_reqstat_module=shared --with-http_lua_module=shared --add-module=../nginx-auth-ldap

拷贝动态共享对象文件到安装目录的modules目录

# make dso_install

7、修改主配置文件

# vim nginx.conf
user www;
worker_processes 8;
worker_rlimit_nofile 409600;
pid sbin/nginx-tengine.pid; #error_log logs/error.log;
#error_log logs/error.log notice;
error_log logs/error.log info; events {
use epoll;
worker_connections 409600;
} # load modules compiled as Dynamic Shared Object (DSO)
#
dso {
# load ngx_http_lua_module;
load ngx_http_reqstat_module.so;
} http {
include mime.types;
default_type application/octet-stream;
server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 64m;
sendfile on;
server_tokens off;
tcp_nopush on;
keepalive_timeout 60;
tcp_nodelay on;
add_header Xdebug proxy01;
proxy_connect_timeout 60;
proxy_read_timeout 60;
proxy_send_timeout 60;
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
proxy_temp_file_write_size 256k;
proxy_ignore_client_abort on;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types text/plain text/css application/json application/x-javascript text/xml text/javascript image/png image/jpgi application/javascripti image/jpeg;
gzip_vary on; lua_package_path "/usr/local/nginx/lua/redis.lua;;"; map $http_upgrade $connection_upgrade {
default "";
'' "";
} log_format oupeng_logs '$remote_addr - $remote_user [$time_local] "$request" "$request_body" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" $http_x_forwarded_for '
'$request_time $upstream_response_time'; log_format mini.oupeng '"$remote_addr" "$remote_user" "$time_local" "$request" '
'"$status" "$body_bytes_sent" "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" '
'"$http_x_operette_branding" "$http_x_nhorizon_channel_id" '
'"$http_x_operamini_screen_width" "$http_x_operamini_screen_height" '
'"$http_x_operamini_id" "$http_x_operamini_phone_ua"'; log_format main '[$time_local] $status $remote_addr "$request" "$upstream_addr"'; log_format json '{"@timestamp":"$time_iso8601",'
'"host":"$server_addr",'
'"clientip":"$remote_addr",'
'"remote_user":"$remote_user",'
'"request":"$request",'
'"http_user_agent":"$http_user_agent",'
'"cookie_uid":"$cookie_uid",'
'"size":$body_bytes_sent,'
'"responsetime":$request_time,'
'"upstreamtime":"$upstream_response_time",'
'"upstreamhost":"$upstream_addr",'
'"http_host":"$host",'
'"url":"$uri",'
'"domain":"$host",'
'"xff":"$http_x_forwarded_for",'
'"referer":"$http_referer",'
'"status":"$status"}'; include vhosts/*.conf ;
}

8、添加ldap配置

# mkdir vhosts
# cd vhosts/ # vim a_ldap.conf
ldap_server ldapsv {
url ldap://192.168.2.164:389/dc=beijing,dc=op?uid?sub?(&(objectClass=person));
binddn "cn=admin,dc=beijing,dc=op";
binddn_passwd "D3llD3ll";
group_attribute uid;
group_attribute_is_dn on;
require valid_user;
}

9、添加kibana代理配置

# vim kibana.conf
upstream kibana-oupeng-com {
server 192.168.3.56:5601 weight=10 max_fails=3 fail_timeout=10;
server 192.168.3.49:5601 weight=10 max_fails=3 fail_timeout=10;
server 192.168.3.57:5601 weight=10 max_fails=3 fail_timeout=10;
ip_hash;
check interval=5000 rise=2 fall=5 timeout=1000 type=tcp;
} server {
listen 80;
server_name kibana.oupeng.com;
# auth_basic "Restricted Access";
# auth_basic_user_file /usr/local/nginx/conf/htpasswd.users; auth_ldap "Forbidden";
auth_ldap_servers ldapsv; location / {
proxy_pass http://kibana-oupeng-com;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}

10、启动nginx

# /usr/local/nginx/sbin/nginx -t
# /usr/local/nginx/sbin/nginx

11、查看版本和模块信息

# /usr/local/nginx/sbin/nginx -V

debian7编译安装tengine添加lua和ldap模块的更多相关文章

  1. alpine编译安装tengine,并使用supervisor启动

    Alpine是一个小型的linux系统,官方docker镜像只有不到5MB,非常适合作为容器镜像. Alpine Linux is a security-oriented, lightweight L ...

  2. CentOS 7编译安装Tengine+PHP+MariaDB全程笔记

    安装环境:CentOS7 3.10.0-693.5.2.el7.x86_64 准备源码包: pcre-8.41.tar.gz openssl-1.0.1h.tar.gz zlib-1.2.11.tar ...

  3. centos7 yum安装nginx和 编译安装tengine

    说明 我这里给大家演示一下如何安装nginx,nginx我就不多介绍了,然后我再说一点就是,安装的两种方法都可以,编译安装和yum安装,我不能每个都演示两遍呀,所以看到我这博客的你,学会举一反三好吧? ...

  4. CentOS7 源码编译安装Tengine

    简介 Tengine是由淘宝网发起的Web服务器项目.它在Nginx的基础上,针对大访问量网站的需求,添加了很多高级功能和特性.它的目的是打造一个高效.安全的Web平台. 发展 Tengine的性能和 ...

  5. CentOS 7.2编译安装Tengine

    Tengine官网上有个非常简单的教程,中间并未涉及到一些常用的设置,所以仅供参考.一下午为本人的安装步骤及过程. 配置firewalld,iptables,关闭SELINUX 1.安装必要的编译环境 ...

  6. nginx在centos 7中源码编译安装【添加grpc的支持】

    安装依赖软件 1.安装编译工具gcc gcc是一个开源编译器集合,用于处理各种各样的语言:C.C++.Java.Ada等,在linux世界中是最通用的编译器,支持大量处理器:x86.AMD64.Pow ...

  7. 【01】Nginx:编译安装/动态添加模块

    写在前面的话 说起 Nginx,别说运维,就是很多开发人员也很熟悉,毕竟如今已经 2019 年了,Apache 更多的要么成为了历史,要么成为了历史残留. 我们在提及 Nginx 的时候,一直在强调他 ...

  8. zabbix源码编译安装以及添加第一台host监控

    基础准备 硬件需求 数据库需求   软件需求 其他软件需求 安装 安装方式 source code 编译好的二进制包 rpm或者deb 源码编译安装部署zabbix以及附件 前提准备 最小化安装操作系 ...

  9. 编译安装LAMP之php(fpm模块)

    一,准备工作实验平台为CentOS6.6,先下载所需的安装包,我使用的是php-5.4.26.tar.gz,下载地址 http://mirrors.sohu.com/php/ 编译安装的目录:/usr ...

随机推荐

  1. Hadoop源码阅读环境搭建(IDEA)

    拿到一份Hadoop源码之后,经常关注的两件事情就是 1.怎么阅读?涉及IDEA和Eclipse工程搭建.IDEA搭建,选择源码,逐步导入即可:Eclipse可以选择后台生成工程,也可以选择IDE导入 ...

  2. mtr的用法场景

    ---引用自阿里云 mtr (My traceroute)也是几乎所有 Linux 发行版本预装的网络测试工具.他把 ping和 traceroute 的功能并入了同一个工具中,所以功能更强大. mt ...

  3. Python-opencv摄像头图像捕获

    实例一 (灰色调度) #!/usr/bin/env python # _*_ coding:utf-8 _*_ import cv2 as cv import numpy as np capture ...

  4. pssh命令详解

    基础命令学习目录首页 原文链接:https://www.cnblogs.com/kevingrace/p/6378719.html pssh提供OpenSSH和相关工具的并行版本.包括pssh,psc ...

  5. 使用sass与compass合并雪碧图(二)

    上一篇文章介绍了怎样使用compass合并雪碧图,生成的icons.css文件中单位是px,PC端可以直接在html文件中使用,但在移动端,我们需要根据不同分辨率的屏幕,来缩放图片大小,显然使用px单 ...

  6. [BUAA软工]第0次个人作业

    [BUAA软工]第0次个人作业 本次作业所属课程 : 2019BUAA软件工程 本次作业要求: 第0次个人作业 我在本课程的目标: 熟悉软件工程流程,规范开发习惯 本次作业的帮助: 熟悉课程流程 Pa ...

  7. H-ui框架制作选项卡

    本案例运用H-ui框架,写了一个选项卡案例 1. html代码(固定这样写,用一个div包裹控制条tabBar和内容条tabCon) <div id="tab-index-carteg ...

  8. vs2013+python+ cocos2d-x-3.3rc0环境搭建

    1.vs2013安装一路next,安装即可,时间1~2个小时 2.解压cocos2d-x-3.3rc0   build文件夹里会有名为  cocos2d-win32.vc2012的sln文件  打开  ...

  9. 《Spring2之站立会议5》

    <Spring2之站立会议5> 昨天,接着对主界面进行代码的编写,实现了界面的美化,从图片库中调了一些图片对其进行优化: 今天,向主界面中加入语音功能部分的代码: 遇到的问题:发现虽然是调 ...

  10. java的小学生四则运算

    import java.awt.*; import java.awt.event.*; import java.io.FileNotFoundException; import java.io.IOE ...