栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

nginx 安装lua 模块

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

nginx 安装lua 模块

1.配置yum源
#下载阿里云的yum源
wget -O /etc/yum.repos.d/CentOS-base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum clean all
yum repolist
yum -y install gcc gcc-c++ ncurses-devel autoconf
useradd -s /sbin/nologin -M nginx  ## 创建一个nginx 用户 创不创建无所谓
### 把nginx的包拉上去
tar xf nginx-1.12.0.tar.gz -C /usr/local/


# 下载lua的包
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 && make install PREFIX=/usr/local/LuaJIT
vim /etc/profile
## 在最后添加以下两行
export LUAJIT_LIB=/usr/local/LuaJIT/lib
export LUAJIT_INC=/usr/local/LuaJIT/include/luajit-2.0
# 生效 /etc/profile
 . /etc/profile
cd

wget https://github.com/vision5/ngx_devel_kit/archive/refs/tags/v0.3.0.tar.gz
tar xf v0.10.9rc7.tar.gz -C /usr/local/src/

wget https://github.com/openresty/lua-nginx-module/archive/v0.10.9rc7.tar.gz
tar xf ngx_devel_kit-0.3.0.tar.gz -C /usr/local/src/

cd /usr/local/nginx-1.12.0/

./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_stub_status_module --add-module=/usr/local/src/ngx_devel_kit-0.3.0 --add-module=/usr/local/src/lua-nginx-module-0.10.9rc7

make && make install

cd /usr/local/nginx/conf
vim nginx.conf
添加以下几行
 

echo "/usr/local/LuaJIT/lib" >> /etc/ld.so.conf

ldconfig

cd /usr/local/nginx/sbin/
./nginx -t  ##  检查配置文件是否有问题
./nginx 启动
然后在浏览器访问

http://192.168.11.11/lua

出现hello,lua! 就算成功

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/335764.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号