GVKun编程网logo

OpenResty (nginx_lua_module) 做 ES 代理以及备份 ES 数据(es数据备份到hadoop)

20

本文的目的是介绍OpenResty(nginx_lua_module)做ES代理以及备份ES数据的详细情况,特别关注es数据备份到hadoop的相关信息。我们将通过专业的研究、有关数据的分析等多种方式

本文的目的是介绍OpenResty (nginx_lua_module) 做 ES 代理以及备份 ES 数据的详细情况,特别关注es数据备份到hadoop的相关信息。我们将通过专业的研究、有关数据的分析等多种方式,为您呈现一个全面的了解OpenResty (nginx_lua_module) 做 ES 代理以及备份 ES 数据的机会,同时也不会遗漏关于(转) OpenResty (nginx+lua) 开发入门、fastdfs-nginx-module跟lua_nginx_module这两个模块有没有办法整合、Lua:Nginx Lua环境配置,使用openresty、nginx 动态加载(ngx_dso_module)模块 nginx ajp module nginx ssl module nginx kafka modul的知识。

本文目录一览:

OpenResty (nginx_lua_module) 做 ES 代理以及备份 ES 数据(es数据备份到hadoop)

OpenResty (nginx_lua_module) 做 ES 代理以及备份 ES 数据(es数据备份到hadoop)

#user  nobody;
worker_processes  1;
 
#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;
 
pid        logs/nginx.pid;
 
events {
    worker_connections  1024;
}
 
http {
 
    upstream master {
        server 10.1.1.100:9200;
        server 10.1.1.100:9200 backup;
        keepalive 15;
    }
 
    upstream slave {
        server 10.1.1.100:9200;
        keepalive 15;
    }
 
    server {
        server_name localhost 127.0.0.1 10.1.1.225;
        listen 8888;
 
        location / {
 
            #if ($request_method = "GET") {
                #proxy_pass http://master; # get直接走upstream master
            #}
 
            content_by_lua_block {
 
                local function getFile(file_name)
                    local f = assert(io.open(file_name, ''r''))
                    local string = f:read("*all")
                    f:close()
                    return string
                end
 
                ngx.req.read_body()
                ngx.log(ngx.ERR, ''$$$'' ..ngx.var.request_uri .. ''$$$'')
 
                local request_body = ngx.req.get_body_data()
                if nil == request_body then
                    local file_name = ngx.req.get_body_file()
                    if file_name then
                        request_body = getFile(file_name)
                    end
                end
 
                local master_resp, slave_resp
                local req_method_constant = ngx[''HTTP_'' .. ngx.req.get_method()]
                local arry = {method = req_method_constant, body = request_body}
 
                if req_method_constant == ngx.HTTP_POST or req_method_constant == ngx.HTTP_PUT or req_method_constant == ngx.HTTP_DELETE then
                    master_resp, slave_resp = ngx.location.capture_multi{
                        {''/slave'' .. ngx.var.request_uri, arry},
                        {''/master'' .. ngx.var.request_uri, arry}
                    }
                else
                    master_resp = ngx.location.capture_multi{
                        {''/master'' .. ngx.var.request_uri, arry}
                    }
                end
 
                --[[
                    使用master的响应头
                --]]
                for k,v in pairs(master_resp.header) do
                    ngx.header[k] = v
                end
                ngx.say(master_resp.body)
            }
        }
 
        location ~* ^/master {
            internal;
            log_subrequest on;
            rewrite ^/master(.*)$ $1 break;
            proxy_pass http://master;
            access_log logs/master.log;
        }
 
        location ~* ^/slave {
            internal;
            log_subrequest on;
            rewrite ^/slave(.*)$ $1 break;
            proxy_pass http://slave;
            access_log logs/slave.log;
        }
    }
}

 

(转) OpenResty (nginx+lua) 开发入门

(转) OpenResty (nginx+lua) 开发入门

原文:https://blog.csdn.net/enweitech/article/details/78519398

OpenResty 官网:http://openresty.org/  OpenResty® - 中文官方站 http://openresty.org/cn/

OpenResty 是一个 nginx 和它的各种三方模块的一个打包而成的软件平台。最重要的一点是它将 lua/luajit 打包了进来,使得我们可以使用 lua 脚本来进行 web 的开发。有了 lua,我们可以借助于 nginx 的异步非阻塞的功能,达到使用 lua 异步并发访问后端的 MySQL, PostgreSQL, Memcached, Redis 等等服务。特别是特有的 ngx.location.capture_multi 功能让人印象深刻,其可以达到极大的减少浏览器的 http 连接数量,并且可以异步并发的访问后台 Java/PHP/Python 等等接口。OpenResty 架构的 web 可以轻松超越 Node.js 的性能,并且对后端语言没有限制,你可以使用 Java/PHP/Python 等等各种语言。OpenResty (nginx+lua) 可以替代 node.js 的前端渲染的功能。

火云邪神语录:天下武功,无坚不破,唯快不破!Nginx 的看家本领就是速度,Lua 的拿手好戏亦是速度,这两者的结合在速度上无疑有基因上的优势。


最先将 Nginx,Lua 组合到一起的是 OpenResty,它有一个 ngx_lua 模块,将 Lua 嵌入到了 Nginx 里面;随后 Tengine 也包含了 ngx_lua 模块。至于二者的区别:OpenResty 是 Nginx 的 Bundle;而 Tengine 则是 Nginx 的 Fork。值得一提的是,OpenResty 和 Tengine 均是国人自己创建的项目,前者主要由春哥和晓哲开发,后者主要由淘宝打理。

至于 OpenResty 和 Tengine 孰优孰劣,留给大家自己判断,如下资料可供参考:

ngx_openresty: an Nginx ecosystem glued by Lua
淘宝网 Nginx 应用、定制与开发实战
推荐看看春哥在 Tech-Club 上关于『由 Lua 粘合的 Nginx 生态环境』的演讲实录,有料!

安装
需要最新版的 Nginx,LuaJIT,ngx_devel_kit,ngx_lua 等安装文件。

安装 Lua 或者 LuaJIT 都是可以的,但是出于效率的考虑,推荐安装 LuaJIT。

详细参考:Nginx 与 Lua | 火丁笔记 https://huoding.com/2012/08/31/156
OpenResty (aka. ngx_openresty) is a full-fledged web application server by bundling the standard Nginx core, lots of 3rd-party Nginx modules, as well as most of their external dependencies.

By taking advantage of various well-designed Nginx modules, OpenResty effectively turns the nginx server into a powerful web app server, in which the web developers can use the Lua programming language to script various existing nginx C modules and Lua modules and construct extremely high-performance web applications that are capable to handle 10K+ connections.

OpenResty aims to run your server-side web app completely in the Nginx server, leveraging Nginx''s event model to do non-blocking I/O not only with the HTTP clients, but also with remote backends like MySQL, PostgreSQL, Memcached, and Redis.

1. 安装 OpenResty

先安装依赖:yum install readline-devel pcre-devel openssl-devel gcc

解压: tar zxvf ngx_openresty-1.9.3.1.tar.gz

建立一个软连接:ln -s ngx_openresty-1.9.3.1 openresty

进入目录:cd openresty

编译:


./configure \
--with-cc-opt="-I/usr/local/include" \
--with-ld-opt="-L/usr/local/lib" \
--prefix=/opt/openresty

... ...
Configuration summary
  + using system PCRE library
  + using system OpenSSL library
  + md5: using OpenSSL library
  + sha1: using OpenSSL library
  + using system zlib library

  nginx path prefix: "/opt/openresty/nginx"
  nginx binary file: "/opt/openresty/nginx/sbin/nginx"
  nginx configuration prefix: "/opt/openresty/nginx/conf"
  nginx configuration file: "/opt/openresty/nginx/conf/nginx.conf"
  nginx pid file: "/opt/openresty/nginx/logs/nginx.pid"
  nginx error log file: "/opt/openresty/nginx/logs/error.log"
  nginx http access log file: "/opt/openresty/nginx/logs/access.log"
  nginx http client request body temporary files: "client_body_temp"
  nginx http proxy temporary files: "proxy_temp"
  nginx http fastcgi temporary files: "fastcgi_temp"
  nginx http uwsgi temporary files: "uwsgi_temp"
  nginx http scgi temporary files: "scgi_temp"

其中 --prefix=/opt/openresty 指定了安装目录,不指定的话默认会安装到 /usr/local/openresty 目录下。

编译安装: make && make install

[root@localhost src]# cd /opt/openresty/
[root@localhost openresty]# ls
bin luajit lualib nginx
可以看到 /opt/openresty 目录下四个文件夹,其中包括了 luajit,nginx。

启动 openresty: /opt/openresty/nginx/sbin/nginx -c /opt/openresty/nginx/conf/nginx.conf -p /opt/openresty/nginx/

[root@localhost src]# ps -elf|grep nginx
1 S root 2076 1 0 80 0 - 34999 - 21:24 ? 00:00:00 nginx: master process /opt/openresty/nginx/sbin/nginx -c /opt/openresty/nginx/conf/nginx.conf -p /opt/openresty/nginx/
5 S nobody 2077 2076 0 80 0 - 35045 - 21:24 ? 00:00:00 nginx: worker process
0 S root 2079 1678 0 80 0 - 1088 - 21:24 pts/1 00:00:00 grep nginx
验证可以访问: curl 127.0.0.1

2. content_by_lua 和 content_by_lua_file

nginx 如何嵌入 lua 脚本。方法就是在 nginx 的配置文件 nginx.conf 中使用 content_by_lua 或者 cotent_by_lua_file 指令:

1) content_by_lua 一般在很简单的 lua 脚本时使用:


location /lua {
set $test "hello, world.";
content_by_lua ''
ngx.header.content_type = "text/plain";
ngx.say(ngx.var.test);
'';
}

访问 http://localhost/lua 可以看到输出到页面的  hello, world.

2)cotent_by_lua_file 适应于复杂的 lua 脚本,专门放入一个文件中:

location /lua2 {
#lua_code_cache off;
content_by_lua_file lua/hello.lua;
}
路径相对于 /opt/openresty/nginx

[root@localhost lua]# pwd
/opt/openresty/nginx/lua
[root@localhost lua]# cat hello.lua
ngx.say(''hello ngx_lua!!!!'');
本例子中 hello.lua 只包含一句: ngx.say (''hello ngx_lua!!!!'');

访问 /lua2 :

[root@localhost lua]# curl localhost/lua
hello ngx_lua!!!!
可以看到访问成功。

在 nginx.conf 文件的 server {.. ...} 中加入 lua_code_cache off; 可以方便调试 lua 脚本,修改 lua 脚本之后,不需要 reload nginx.

openresty 中的 nginx 嵌入 luajit 的原理:

 

每一个 nginx 的进程中都嵌入了一个 luajit 的虚拟机,来执行 lua 脚本。nginx 将 lua 脚本的执行交给了 luajit vm.

3. ngx_lua 的指令 和 API

上面我们说到 nginx 嵌入 lua 脚本可以使用 content_by_lua 和 content_by_lua_file,它们其实是指令 (Directives),类似的指令还有很多,

具体参见:https://www.nginx.com/resources/wiki/modules/lua/#directives

 

这些指令都是 nginx 访问 lua 脚本的入口。

ngx_lua API:

指令是 nginx 访问 lua 脚本的入口。那么 lua 脚本如何调用 nginx 中的函数呢?就是通过 ngx_lua 的 API 。

具体介绍参见:https://www.nginx.com/resources/wiki/modules/lua/#nginx-api-for-lua

The various *_by_lua and *_by_lua_file configuration directives serve as gateways to the Lua API within the nginx.conf file. The NGINX Lua API described below can only be called within the user Lua code run in the context of these configuration directives.

The API is exposed to Lua in the form of two standard packages ngx and ndk. These packages are in the default global scope within ngx_lua and are always available within ngx_lua directives.

 

其实 nginx 和 Lua 的交互开发主要就是指令和 API,当然还有 lua 脚本的语法。指令是 nginx 访问 lua 的入口,API 是 lua 调用 nginx 的函数,lua 是脚本编程语言。

指令其实很简单,所以主要就是熟悉 ngx_lua 的 API 和 Lua 语法。

4. lua 访问 redis

lua-resty-redis 模块:https://github.com/openresty/lua-resty-redis (有文档可以参考)

在 nginx.conf 中加入:

location /redis_test{
content_by_lua_file lua/redis_test.lua;
}
redis_test.lua 内容:


[root@localhost lua]# cat redis_test.lua
local redis = require "resty.redis"
local red = redis:new()

red:set_timeout(1000)

local ok, err = red:connect("127.0.0.1", 6379)
if not ok then
ngx.say("failed to connect: ", err)
return
end

ngx.say("set result: ", ok)

local res, err = red:get("dog")
if not res then
ngx.say("failed to get doy: ", err)
return
end

if res == ngx.null then
ngx.say("dog not found.")
return
end

ngx.say("dog: ", res)

[root@localhost lua]#

访问:

[root@localhost lua]# curl localhost/redis_test
set result: 1
dog: an animal
[root@localhost lua]#
我们看到访问成功。

5. lua 访问 mysql

openresty 的 mysql 模块:lua-resty-mysql :https://github.com/openresty/lua-resty-mysql(有文档可以参考)

在 nginx.conf 加入如下配置:

location /mysql_test {
content_by_lua_file lua/mysql_test.lua;
}
mysql_test.lua 脚本内容:


[root@localhost lua]# pwd
/opt/openresty/nginx/lua
[root@localhost lua]# cat mysql_test.lua
local mysql = require "resty.mysql"
local db, err = mysql:new()

if not db then
ngx.say("failed to instantiate mysql: ", err)
return
end

db:set_timeout(1000)

local ok, err, errno, sqlstate = db:connect{
host = "127.0.0.1",
port = 3306,
database = "ngx_lua",
user = "root",
password="digdeep",
max_packet_size = 1024 * 1024
}

if not ok then
ngx.say("failed to connect: ", err, ": ", errno, " ", sqlstate)
return
end

ngx.say("connected to mysql.")

local res, err, errno, sqlstate = db:query("drop table if exists cats")
if not res then
ngx.say("bad result: ", err, ": ", errno, ": ", sqlstate, ".")
return
end

res, err, errno, sqlstate = db:query("create table cats " .. "(id int not null primary key auto_increment, "
.. "name varchar(30))")
if not res then
ngx.say("bad result: ", err, ": ", errno, ": ", sqlstate, ".")
return
end

ngx.say("table cats created.")

res, err, errno, sqlstate = db:query("insert into cats(name) " .. "values (\''Bob\''),(\''\''),(null)")
if not res then
ngx.say("bad request: ", err, ": ", errno, ": ", sqlstate, ".")
return
end

ngx.say(res.affected_rows, " rows inserted into table cats ", "(last insert id: ", res.insert_id, ")")

res, err, errno, sqlstate = db:query("select * from cats order by id asc", 10)
if not res then
ngx.say("bad result ", err, ": ", errno, ": ", sqlstate, ".")
return
end

local cjson = require "cjson"
ngx.say("result: ", cjson.encode(res))

local ok, err = db:set_keepalive(1000, 100)
if not ok then
ngx.say("failed to set keepalive: ", err)
return
end

测试:

[root@localhost lua]# curl localhost/mysql_test
connected to mysql.
table cats created.
3 rows inserted into table cats (last insert id: 1)
result: [{"name":"Bob","id":1},{"name":"","id":2},{"name":null,"id":3}]
测试通过。

5. lua 的 capture 和 capture_multi (子查询)

capture_multi 是 openresty 一个十分强大的功能。它能极大的减少前端浏览器发送的 http 请求的数量,突破了浏览器对于同一个服务器并发请求数量的限制,因为他可以将前端的多个 http 请求减少为只要一个 http 请求到 nginx,然后 nginx 使用 capture_multi 特性,对后端发起多个异步并发请求,然后统一将结果返回给前端。下面看一个例子:

首先在 nginx.conf 中加入下面的 location 配置,并且配置好 nginx 访问 php 的配置:


location /capture {
content_by_lua_file lua/capture.lua;
#access_by_lua_file lua/capture.lua;
}

location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}

capture.lua 的代码如下:


[root@localhost lua]# pwd
/opt/openresty/nginx/lua
[root@localhost lua]# cat capture.lua
local res1,res2,res3,res4 = ngx.location.capture_multi{
{"/mysql_test", {args="t=1&id=1"}},
{"/redis_test", {args="t=2&id=2"}},
{"/lua", {args="t=3&id=3"}},
{"/index.php", {args="t=3&id=3"}},
}

ngx.header.content_type="text/plain"
ngx.say(res1.body)
ngx.say(res2.body)
ngx.say(res3.body)
ngx.say(res4.truncated)
ngx.say(res4.status)
ngx.say(res4.header["Set-Cookie"])

--ngx.say(res4.body)

index.php 代码:

[root@localhost html]# pwd
/opt/openresty/nginx/html
[root@localhost html]# cat index.php
<?php
echo phpinfo();
?>
访问:


[root@localhost html]# curl localhost/capture
connected to mysql.
table cats created.
3 rows inserted into table cats (last insert id: 1)
result: [{"name":"Bob","id":1},{"name":"","id":2},{"name":null,"id":3}]

set result: 1
dog: an animal

hello ngx_lua!!!!

false
200
nil

可以看到访问成功了。/mysql_test,/redis_test, /lua, /index.php 四个请求的结果都输出了。

注意:

ngx.location.capture_multi {... ...} 中的多个异步并发请求可以是 nginx.conf 中配置的 location (比如 /mysql_test, /redis_test, /lua),也可以不是 location 配置的路径,比如 index.php 就不是。index.php 就是一个简单的后台 php 脚本。当然也可以是一个 java 实现的后台接口。

6. openresty 的缓存 lua_shared_dict

定义一个缓存:

在 nginx 的配置文件 nginx.conf 的 http 端下面加入指令:

lua_shared_dict ngx_cache 128m;
就定义了一个 名称为 ngx_cache 大小为 128m 的内存用于缓存,注意该缓存是所有 nginx work process 所共享的。

在 lua 脚本中访问缓存:

local ngx_cache = ngx.shared.ngx_cache
local value = ngx_cache:get(key)

local succ, err, forcible = ngx_cache:set(key, value, exptime)
下面测试一下,首先在 nginx.conf 的 server 端中加入:

location /cache {
content_by_lua_file lua/cache.lua;
}
然后编写 cache.lua 脚本:


[root@localhost lua]# cat cache.lua
local redis = require "resty.redis"
local red = redis:new()

function set_to_cache(key, value, exptime)
if not exptime then
exptime = 0
end
local ngx_cache = ngx.shared.ngx_cache
local succ, err, forcible = ngx_cache:set(key, value, exptime)
return succ
end

function get_from_cache(key)
local ngx_cache = ngx.shared.ngx_cache;
local value = ngx_cache:get(key)
if not value then
value = get_from_redis(key)
set_to_cache(key, value)
return value
end

ngx.say("get from cache.")
return value
end

function get_from_redis(key)
red:set_timeout(1000)

local ok, err = red:connect("127.0.0.1", 6379)
if not ok then
ngx.say("failed to connect: ", err)
return
end

local res, err = red:get(key)
if not res then
ngx.say("failed to get doy: ", err)
return ngx.null
end

ngx.say("get from redis.")
return res
end

function set_to_redis(key, value)
red:set_timeout(1000)
local ok, err = red:connect("127.0.0.1", 6379)
if not ok then
ngx.say("failed to connect: ", err)
return
end

local ok, err = red:set(key, value)
if not ok then
ngx.say("failed to set to redis: ", err)
return
end
return ok
end

set_to_redis(''dog'', "Bob")
local rs = get_from_cache(''dog'')
ngx.say(rs)

测试:


[root@localhost ~]# curl localhost/cache
get from redis.
Bob
[root@localhost ~]# curl localhost/cache
get from cache.
Bob
[root@localhost ~]# curl localhost/cache
get from cache.
Bob

第一次从 redis 中获取,以后每次都从 cache 中获取。

可以使用 ab 测试一下 rps (Requests per second):

ab -n 1000 -c 100 -k http://127.0.0.1/cache
7. 解决缓存失效风暴 lua-resty-lock

缓存失效风暴是指缓存因为时间过期而失效时,会导致所有的请求都去访问 后台的 redis 或者 mysql,而导致 CPU 性能即刻增长的现象。所以关键是当缓存失效时,用 lock 保证只有一个线程去访问后台的 redis 或者 mysql,然后更新缓存。需要使用到 lua-resty-lock 模块的加锁、解锁功能。

lua-resty-lock 文档:https://github.com/openresty/lua-resty-lock

首先在 nginx.conf 的 http 端下面加入指令:

lua_shared_dict ngx_cache 128m; # cache
lua_shared_dict cache_lock 100k; # lock for cache
然后在 nginx.conf 的 server 端中加入:

location /cache_lock {
content_by_lua_file lua/cache_lock.lua;
}
cache_lock.lua 代码:

 View Code
测试:

[root@localhost lua]# curl localhost/cache_lock
get from cache.
Bob
[root@localhost lua]# curl localhost/cache_lock
get from cache.
Bob
7. openresty 执行阶段

nginx 的执行阶段分成了很多个阶段,所以第三方模块就可以在某个适当的阶段加入一些处理。openresty 进行了简化成了 7 个阶段:

 

7 个阶段的执行顺序如下:

set_by_lua: 流程分支判断,判断变量初始哈

rewrite_by_lua: 用 lua 脚本实现 nginx rewrite

access_by_lua: ip 准入,是否能合法性访问,防火墙

content_by_lua: 内存生成

header_filter_by_lua:过滤 http 头信息,增加头信息

body_filter_by_lua: 内容大小写,内容加密

log_by_lua: 本地 / 远程记录日志

但是其实我们可以只用 content_by_lua,所有功能都在该阶段完成,也是可以的。

总结:

OpenResty® 是一个基于 Nginx 与 Lua 的高性能 Web 平台,其内部集成了大量精良的 Lua 库、第三方模块以及大多数的依赖项。用于方便地搭建能够处理超高并发、扩展性极高的动态 Web 应用、Web 服务和动态网关。

OpenResty® 通过汇聚各种设计精良的 Nginx 模块(主要由 OpenResty 团队自主开发),从而将 Nginx 有效地变成一个强大的通用 Web 应用平台。这样,Web 开发人员和系统工程师可以使用 Lua 脚本语言调动 Nginx 支持的各种 C 以及 Lua 模块,快速构造出足以胜任 10K 乃至 1000K 以上单机并发连接的高性能 Web 应用系统。

OpenResty® 的目标是让你的 Web 服务直接跑在 Nginx 服务内部,充分利用 Nginx 的非阻塞 I/O 模型,不仅仅对 HTTP 客户端请求,甚至于对远程后端诸如 MySQL、PostgreSQL、Memcached 以及 Redis 等都进行一致的高性能响应。

参考 组件 可以知道 OpenResty® 中包含了多少软件。

参考 上路 学习如何从最简单的 hello world 开始使用 OpenResty® 开发 HTTP 业务,或前往 下载 直接获取 OpenResty® 的源代码包开始体验。
---------------------
作者:天府云创
来源:CSDN
原文:https://blog.csdn.net/enweitech/article/details/78519398
版权声明:本文为博主原创文章,转载请附上博文链接!

fastdfs-nginx-module跟lua_nginx_module这两个模块有没有办法整合

fastdfs-nginx-module跟lua_nginx_module这两个模块有没有办法整合

我想用lua_nginx_module作缩略图,但是fastdfs不是直接文件系统访问,这两个模块怎么整合有没同学知道呢?

      

Lua:Nginx Lua环境配置,使用openresty

Lua:Nginx Lua环境配置,使用openresty

总结

以上是小编为你收集整理的Lua:Nginx Lua环境配置,使用openresty全部内容。

如果觉得小编网站内容还不错,欢迎将小编网站推荐给好友。

nginx 动态加载(ngx_dso_module)模块 nginx ajp module nginx ssl module nginx kafka modul

nginx 动态加载(ngx_dso_module)模块 nginx ajp module nginx ssl module nginx kafka modul

根据 tengine 官网的介绍 ngx_dso_module 模块主要是用来运行时动态加载模块,而不用每次都要重新编译tengine。动态加载模块的个数限制则为128个,如果已经加载的动态模块有修改,那么必须重起tengine才会生效,并且只支持http模块。

其实 ngx_dso_module 是tenginx自带的模块;在编译安装tengine的时候已经安装了,可以通过 sbin/nginx -V 进行查看,如:

nginx rtmp module,nginx upload module,nginx module development,echo nginx module,nginx module 开发,nginx ajp module,nginx ssl module,nginx kafka modul

那它的作用呢,就是动态的加载模块,而不必重新./configure && make && make install

语法:load module_name module_path
作用段:dso
默认:none

配置使用示例:

将 ngx_http_lua_module.so 动态进行加载,默认情况下module_path是需要指定的,如果没有进行指定,则默认加载路径的相对路径(NGX_PREFIX/modules或者说configure时通过–dso-path设置的路径),也就是/usr/local/nginx/modules

nginx rtmp module,nginx upload module,nginx module development,echo nginx module,nginx module 开发,nginx ajp module,nginx ssl module,nginx kafka modul

在 nginx.conf 中进行配置

nginx rtmp module,nginx upload module,nginx module development,echo nginx module,nginx module 开发,nginx ajp module,nginx ssl module,nginx kafka modul

配置完成之后执行 sbin/nginx -t 进行校验语法是否正确,接着执行 sbin/nginx -s reload 进行重载,动态加载的模块即可生效。

nginx rtmp module,nginx upload module,nginx module development,echo nginx module,nginx module 开发,nginx ajp module,nginx ssl module,nginx kafka modul

模块地址:https://yunpan.cn/cqSKP6BrJ2AeT 访问密码 4f50

'').addClass(''pre-numbering'').hide(); $(this).addClass(''has-numbering'').parent().append($numbering); for (i = 1; i '').text(i)); }; $numbering.fadeIn(1700); }); });

以上就介绍了nginx 动态加载(ngx_dso_module)模块,包括了module,nginx方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

我们今天的关于OpenResty (nginx_lua_module) 做 ES 代理以及备份 ES 数据es数据备份到hadoop的分享已经告一段落,感谢您的关注,如果您想了解更多关于(转) OpenResty (nginx+lua) 开发入门、fastdfs-nginx-module跟lua_nginx_module这两个模块有没有办法整合、Lua:Nginx Lua环境配置,使用openresty、nginx 动态加载(ngx_dso_module)模块 nginx ajp module nginx ssl module nginx kafka modul的相关信息,请在本站查询。

本文标签: