ARM架构下宝塔面板为Nginx编译支持LuaJIT和lua-cjson

最近在试用宝塔面板,然而ARM架构下无法安装LuaJIT
找了一下资料,装上了宝塔WAF防火墙防CC
这个教程还有不完善的地方,自己想办法

添加预处理编译文件

以下命令在SHELL中执行
cat>/www/server/panel/install/nginx_prepare.sh<<EOL
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
wget -c -O LuaJIT-2.1.zip https://github.com/LuaJIT/LuaJIT/archive/refs/heads/v2.1.zip -T 10
unzip LuaJIT-2.1.zip
if [ -e LuaJIT-2.1 ]; then
    cd LuaJIT-2.1
    make linux
    make install
    export LUAJIT_LIB=/usr/local/lib
    export LUAJIT_INC=/usr/local/include/luajit-2.1/
    ln -sf /usr/local/lib/libluajit-5.1.so.2 /usr/local/lib64/libluajit-5.1.so.2
    if [ $(grep -c /usr/local/lib /etc/ld.so.conf) -eq 0 ]; then
        echo "/usr/local/lib" >> /etc/ld.so.conf
    fi
    ldconfig
    cd ..
fi
rm -rf LuaJIT-2.1*
if [ ! -f /usr/local/lib/lua/5.1/cjson.so ];then
                wget -O lua-cjson-2.1.0.tar.gz http://download.bt.cn/install/src/lua-cjson-2.1.0.tar.gz -T 20
                tar zxvf lua-cjson-2.1.0.tar.gz
                rm -f lua-cjson-2.1.0.tar.gz
                cd lua-cjson-2.1.0
                make
                make install
                cd ..
                rm -rf lua-cjson-2.1.0
                ln -sf /usr/local/lib/lua/5.1/cjson.so /usr/lib64/lua/5.1/cjson.so
                ln -sf /usr/local/lib/lua/5.1/cjson.so /usr/lib/lua/5.1/cjson.so
fi
EOL
sed -i 's/\r//g' /www/server/panel/install/nginx_prepare.sh

最新版nginx添加编译选项


cat>/www/server/panel/install/nginx_configure.pl<<EOL
--add-module=/www/server/nginx/src/ngx_devel_kit --add-module=/www/server/nginx/src/lua_nginx_module
EOL

编译最新版nginx


cd /www/server/panel/install && bash install_soft.sh 0 update nginx 1.20

来源:
https://www.bt.cn/bbs/thread-73777-1-1.html

此处评论已关闭