一.两个依赖包 有yum的直接

yum   yum –y install openssl openssl-devel prce prce-devel zlib zlib-devel

没有yum环境的,可以源码安装:

cd /usr/local

wget https://sourceforge.net/projects/pcre/files/pcre/8.37/pcre-8.37.tar.gz

tar  zxf  pcre-8.37.tar.gz

cd pcre-8.37 && ./configure &&make&&make install

wget http://www.openssl.org/source/openssl-1.0.1c.tar.gz

tar zxf openssl-1.0.1c.tar.gz

cd openssl-1.0.1c.tar.gz &&./config --prefix=/usr/local/openssl -fPIC no-gost no-shared no-zlib

make depend &&make install

wget http://www.zlib.net/zlib-1.2.11.tar.gz

tar zxf zlib-1.2.11.tar.gz

cd /usr/local/zlib-1.2.11 &&./configure

make && make install

二.然后安装LuaJIT

mkdir /usr/local/modules   ###存放所以的第三方模块目录

cd /usr/local/modules

1.wget http://luajit.org/download/LuaJIT-2.0.5.tar.gz

tar -zxvf LuaJIT-2.0.5.tar.gz

cd LuaJIT-2.0.5

make install PREFIX=/usr/local/LuaJIT

最后一行会输出一下提示:

==== Successfully installed LuaJIT 2.0.5 to /usr/local/LuaJIT ====

vi /etc/profile   文件末尾加入环境变量

export LUAJIT_LIB=/usr/local/LuaJIT/lib

export LUAJIT_INC=/usr/local/LuaJIT/include/luajit-2.0

source /etc/profile

ln -s /usr/local/luajit/lib/libluajit-5.1.so.2 /lib64/libluajit-5.1.so.2 #不增加这行,nginx启动会报错

2.下载ngx_devel_kit(NDK)模块 :https://github.com/simpl/ngx_devel_kit/tags,不需要安装

wget https://github.com/simpl/ngx_devel_kit/archive/v0.3.0.tar.gz

tar -xzvf v0.3.0.tar.gz

3.下载最新的lua-nginx-module 模块 :https://github.com/openresty/lua-nginx-module/tags,不需要安装

wget https://github.com/openresty/lua-nginx-module/archive/v0.10.8.tar.gz

tar -xzvf v0.10.8.tar.gz

三.sticky模块(cookie负载均衡,存在客户端的)

wget https://bitbucket.org/nginx-goodies/nginx-sticky-module-ng/get/master.tar.gz

tar -zxf master.tar.gz

nginx-goodies-nginx-sticky-module-ng-c78b7dd79d0d.tar.gz(这个包是tengine sticky的扩展包)

mv  nginx-goodies-nginx-sticky-module-ng-c78b7dd79d0d/ nginx-sticky

四.tengine安装(nginx也是一样)

tengine-2.1.1.tar.gz

tar zxf tengine-2.1.1.tar.gz

cd  tengine-2.1.1

./configure --prefix=/usr/local/nginx --with-pcre=/usr/local/pcre-8.37 --with-pcre-jit --with-zlib=/usr/local/zlib-1.2.11 --with-openssl=/usr/local/openssl-1.0.1c --with-http_sub_module --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module  --with-http_realip_module --with-http_spdy_module --with-http_gunzip_module --with-http_gzip_static_module --add-module=/usr/local/modules/ngx_devel_kit-0.3.0 --add-module=/usr/local/modules/lua-nginx-module-0.10.8 --add-module=/usr/local/modules/nginx-sticky/

make

make install

安装后:

/usr/local/nginx/sbin/nginx -t   查看状态

/usr/local/nginx/sbin/nginx     启动nginx

在/usr/local/nginx/conf/nginx.conf中加入如下代码:

location /hello_lua {
default_type 'text/plain';
content_by_lua 'ngx.say("hello, lua")';
}

重启nginx

访问10.211.55.3/hello_lua会出现”hello, lua”表示lua安装成功

最新文章

  1. Sql Server系列:字符串函数
  2. Matlab代码优化--向量化
  3. Glyphish – 精心打造的 iPhone & iPad 应用程序图标
  4. yum提示another app is currently holding the yum lock;waiting for it to exit
  5. Codeforces Edu3 E. Minimum spanning tree for each edge
  6. [问题2014A10] 复旦高等代数 I(14级)每周一题(第十二教学周)
  7. ORACLE 學習筆記
  8. NULL, '\0',0 '0'的区别
  9. Android 高级UI设计笔记13:Gallery(画廊控件)之 循环显示图像
  10. 【转载】跟我一起云计算(6)——openAPI
  11. hdu1896 bjfu1268 水题
  12. linux gnome 安装
  13. WordPress Simple Login Registration插件’username‘参数跨站脚本漏洞
  14. Python开发【第七篇】:面向对象 和 python面向对象(初级篇)(上)
  15. 取证学习资料DVD
  16. webpack4.0各个击破(10)—— Integration篇
  17. 1-Two Sum @LeetCode
  18. [资源]--IOS捷径大全,众多实用小功能
  19. 求解100以内的所有素数(问题来自PythonTip)
  20. linux 开机自启脚本

热门文章

  1. 2018-2019 ACM-ICPC, Asia Dhaka Regional Contest
  2. [JLOI2013]卡牌游戏 概率DP
  3. linux系列(六):rmdir命令
  4. WPS-系统缺失字体
  5. Spring Cloud Gateway(九):网关过滤器 GatewayFilter
  6. 使用vscode快速建立vue模板
  7. Navicat Premium 12安装与激活(亲测已成功激活)
  8. Cesium官方教程6--相机
  9. python @abstractmethod
  10. AndroidStudio制作Nine-Patch【.9】图片