ngx_lua 模块安装

一、使用环境

1、Nginx v1.11.2

2、Lua jit v2.0.4

3、ngx_lua_module v0.10.8

4、NDK v0.3.0

注:目前ngx_lua模块对Nginx支持版本最高为(1.11.2)。文章时间(2017年4月24日16:07:36)

二、相关软件下载地址

1、Nginx [http://nginx.org/]

2、Lua Jit [http://luajit.org/download.html]

3、ngx_lua_module [https://github.com/openresty/lua-nginx-module/tags]

4、NDK [https://github.com/simpl/ngx_devel_kit/tags]

三、Lua jit 安装

shell > wget 
shell > tar xf LuaJIT-2.0.4.tar.gz
shell > cd LuaJIT-2.0.4
shell > make && make install
shell > ln -s /usr/local/lib/libluajit-5.1.so.2 /lib64/libluajit-5.1.so.2

注:如果不

ln -s /usr/local/lib/libluajit-5.1.so.2 /lib64/libluajit-5.1.so.2

则会在Nginx 启动时报错: error while loading shared libraries: libluajit-5.1.so.2: cannot open shared object file: No such file or directory

好奇的朋友可以尝试一下

四、ngx_lua_module 和 NDK准备

shell > pwd
/usr/local/src/nginx
shell > wget 
shell > tar xf v0.3.0
#解压v0.3.0 后,文件名为ngx_devel_kit-0.3.0
shell > wget 
shell > tar xf v0.10.8
#解压v0.10.8后,文件名为lua-nginx-module-0.10.8

五、安装Nginx及ngx_lua、NDK模块

shell > yum install -y pcre-devel openssl-devel geoip-devel
#pcre必须,正则支持。
#geoip-devel 必须。因为代码中会使用到geoip数据
shell > export LUAJIT_LIB=/usr/local/lib
shell > export LUAJIT_INC=/usr/local/include/luajit-2.0
shell > useradd nginx -s /sbin/nologin -M
shell > wget 
shell > tar xf nginx-1.11.2.tar.gz
shell > cd nginx-1.11.2
shell > ./configure --prefix=/usr/local/nginx-1.11.2 --user=nginx --group=nginx --with-http_stub_status_module --with-http_ssl_module --with-http_geoip_module --add-module=/usr/local/src/nginx/ngx_devel_kit-0.3.0/ --add-module=/usr/local/src/nginx/lua-nginx-module-0.10.8/
shell > make -j2
shell > make install

六、测试Nginx及nginx_lua模块是否安装成功

shell > cd /usr/local/nginx-1.11.2
shell > egrep -v "#|^$"  conf/nginx.conf.default > conf/nginx.conf 
#初始化Nginx的配置文件。主要是Nginx的默认配置文件太多注释,加上自己能看懂Nginx的配置,
以及看起来不够清爽

如图在server字段中,添加下面代码

location = /hello {
    access_by_lua ‘
        ngx.say("hello")
    ‘;
}

注意标点符号,空格,大小写

shell > /usr/local/nginx-1.11.2/sbin/nginx
启动Nginx

测试:

时间: 2024-08-26 01:07:40

ngx_lua 模块安装的相关文章

LNMP平滑升级nginx并安装ngx_lua模块教程

#ngx_lua module项目地址 https://github.com/chaoslawful/lua-nginx-module 在LNMP安装包后,重编译nginx,并添加ngx_lua模块 1」Download wget http://luajit.org/download/LuaJIT-2.0.4.tar.gz wget https://github.com/simpl/ngx_devel_kit/archive/v0.2.19.tar.gz wget https://github.

第三百二十三节,web爬虫,scrapy模块以及相关依赖模块安装

第三百二十三节,web爬虫,scrapy模块以及相关依赖模块安装 当前环境python3.5 ,windows10系统 Linux系统安装 在线安装,会自动安装scrapy模块以及相关依赖模块 pip install Scrapy 手动源码安装,比较麻烦要自己手动安装scrapy模块以及依赖模块 安装以下模块 1.lxml-3.8.0.tar.gz (XML处理库) 2.Twisted-17.5.0.tar.bz2 (用Python编写的异步网络框架) 3.Scrapy-1.4.0.tar.gz

mod_python模块安装使用

二.mod_python 1.性能 使用mod_python的主要优势在于比传统CGI更高的性能. 一个测试,使用在Pentium 1.2GHz的机器上运行Red Hat Linux 7.3.使用4种类型的脚本,基于标准的CGI导入模块(以典型的Python CGI脚本开始),然后输出'Hello!',测试10000次请求作为基准. 标准CGI: 23 次请求/秒 mod_python CGI处理器: 385 次请求/秒 mod_python 发布处理器: 476 次请求/秒 mod_pytho

python模块安装路径

Unix(Linux): prefix/lib/pythonX.Y/site-packages 默认路径:/usr/local/lib/pythonX.Y/site-packages 另外,在Unix-like系统上,Python自身build-in的模块一般位于:/usr/lib/pythonX.Y/site-packages从源代码安装模块的命令一般为:setup.py install当然,可以根据需要改变默认的第三方模块安装路径,在命令中可以加上参数:–user, or –home, or

Greenplum 的dblink与tablefunc模块安装

1.dblink模块安装 登录主节点并切换到GP用户下 [[email protected] ~]#su - gpadmin 下载源码包并解压,进入dblink目录下 [[email protected] ~]$ wget https://ftp.postgresql.org/pub/source/v8.2.23/postgresql-8.2.23.tar.gz [[email protected] ~]$ tar xvf postgresql-8.2.23.tar.gz  [[email pr

Mac MySQLdb模块安装,可算解决了

转载:http://blog.csdn.net/janronehoo/article/details/25207825 短评:这篇文章感觉是比较全面解决Mac MySQLdb模块安装问题的文章了,特别转载一下. 连错误都解决了...爽,话说困扰我半个月MySQLdb,差点就要放弃了 Python 2.7.3. MySQL-python包中,因此无论下载还是在pip中search,都应该是搜寻MySQL-python. 下载MySQLdb MySQL-python-1.2.4b4.tar,下载后解

Python模块安装问题

python的下载:https://www.python.org/downloads/ 我个人推荐的安装指导:http://www.tuicool.com/articles/eiM3Er3/ 目录------------------------------------------------------ 安装工具setuptools(及基本使用) 安装工具pip(及基本使用)(plus:里面有whl的安装包集链接) Python安装压缩包式的模块 安装加密模块pycrypto ---------

python模块安装目录在哪里

Python的强大,其中一个重要原因是Python有很丰富的库(模块)从而可以比较方便地处理各种各样的问题.Python开发的第三方modules一般都安装在一些固定的路径,如下: Unix(Linux): prefix/lib/pythonX.Y/site-packages 默认路径:/usr/local/lib/pythonX.Y/site-packages Windows: prefix\Lib\site-packages 默认路径:C:\PythonXY\Lib\site-package

python模块安装方式及相关问题

一.python模块 (1)在线安装 先下载ez_setup.py,在命令行运行python ez_setup.py进行easy_install工具的安装后,将C:\Python27\Scripts路径加入环境变量中,就可以使用easy_install在线安装package了,例如 easy_install  mysql-connector-python 卸载使用 easy_install -m mysql-connector-python (2)手动安装 不能在上网环境下可以先下载模块包,解压