侧边栏壁纸
博主头像
CYC的个人博客博主等级

学习使人进步

  • 累计撰写 113 篇文章
  • 累计创建 14 个标签
  • 累计收到 1 条评论

目 录CONTENT

文章目录

Tengine 安装http_lua_module

我是一条酸菜鱼
2026-02-12 / 0 评论 / 0 点赞 / 6 阅读 / 2215 字

Tengine 安装http_lua_module

特别鸣谢github.com/chaoslawful ,感谢您提供的模块,我自己在网上下载了很多次都安装失败了(有时候AI也不是万能的)!

大神的意见就是人狠话不多直接上技术

以centos8为例,安装依赖

dnf install -y gcc gcc-c++ make pcre pcre-devel zlib-devel openssl-devel

下载lua模块

lua-nginx-module-master.zip

git clone https://github.com/chaoslawful/lua-nginx-module.git lua-nginx-module-master

重新编译nginx,添加模块

cd /opt/tengine-x.x.0

./configure --user=nginx --prefix=/data/nginx/apptest --with-ld-opt="-Wl,-rpath,$LUAJIT_LIB"  --add-module=/data/tengine-3.1.0/lua-nginx-module-master


make -j2  

make install

把Tengine做成服务并设置变量

vim /etc/profile
#添加一行
export PATH=/usr/local/nginx/sbin:$PATH

source /etc/profile

##验证###
nginx -V 
vim /usr/lib/systemd/system/nginx.service



#################################################

[Unit]

Description=Tengine Server

After=network.target remote-fs.target nss-lookup.target

[Service]

Environment="CONFFILE=/usr/local/nginx/conf/nginx.conf"

Type=forking

ExecStart=/usr/local/nginx/sbin/nginx -c $CONFFILE

ExecReload=/usr/local/nginx/sbin/nginx -s reload

ExecStop=/usr/local/nginx/sbin/nginx -s stop

[Install]

WantedBy=multi-user.target
####################################################

设置服务器自动启动并查看状态

systemctl enable nginx.service

systemctl start nginx.service

systemctl status nginx.service

ps aux |grep nginx


nginx -V

0

评论区