这种方式是直接安装openresty ,不是通过重新编译nginx
Ubuntu 安装
安装依赖包
<code>$ sudo apt<span>-get</span> install libreadline<span>-dev</span> libncurses5<span>-dev</span> libpcre3<span>-dev</span> libssl<span>-dev</span> perl make</code>
软连接
<code>$ sudo ln <span>-s</span> /usr/lib/x86_64<span>-linux</span><span>-gnu</span>/liblua5<span>.1</span><span>.</span>so /usr/lib/liblua<span>.</span>so</code>
下载安装包
<code>$ http --download http://openresty.org/download/ngx_openresty-<span>1.7</span><span>.10</span><span>.1</span>.tar.gz $tar -zxvf <span>...</span></code>
编译安装
<code>$ <span>.</span>/configure <span>--</span>prefix<span>=</span>/usr/<span>local</span>/openresty <span>--</span><span>with</span><span>-pcre</span><span>-jit</span><span>--</span><span>with</span><span>-ipv6</span><span>--</span>without<span>-http_redis2_module</span><span>--</span><span>with</span><span>-http_iconv_module</span><span>-j2</span> $ sudo make $ sudo make install</code>
安装完成之后就可以在
/usr/local/openresty/nginx/conf/nginx.conf 写nginx lua程序了
centos 上的安装
<code><span># yum install readline-devel pcre-devel openssl-devel</span><span># wget http://openresty.org/download/ngx_openresty-1.7.10.1.tar.gz</span><span># tar zxvf ngx_openresty-1.7.10.1.tar.gz</span><span># cd ngx_openresty-1.7.10.1</span><span># ./configure --with-luajit</span><span># gmake</span><span># gmake install </span></code>
中间报错
<code>/root/softwares/ngx<span>_openresty-1.7.10.1/build/nginx-1.7.10/../ngx_</span>lua-0.9.15/src/ngx<span>_http_</span>lua<span>_regex.c:1948: undefined reference to `pcre_</span>free<span>_study' objs/addon/src/ngx_</span>http<span>_lua_</span>regex.o: In function <span>`ngx_http_lua_ffi_destroy_regex'</span>: /root/softwares/ngx<span>_openresty-1.7.10.1/build/nginx-1.7.10/../ngx_</span>lua-0.9.15/src/ngx<span>_http_</span>lua<span>_regex.c:2335: undefined reference to `pcre_</span>free<span>_study' </span></code>
参考:http://www.cnblogs.com/shuaixf/archive/2012/11/16/2773357.html
参考:
https://github.com/openresty/lua-nginx-module#installation
也可以参考涛哥代码
http://jinnianshilongnian.iteye.com/blog/2190344
声明:
本文出自 “orangleliu笔记本” 博客,转载请务必保留此出处http://blog.csdn.net/orangleliu/article/details/44804991
作者orangleliu 采用署名-非商业性使用-相同方式共享协议
以上就介绍了[openresty]安装nginx_lua,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。