宝塔面板的 Nginx 在 ARM 下支持 LuaJIT

nginx 使用1.20

新建脚本

在 /www/server/panel/install 分别创建名字为 nginx_prepare.sh 和 nginx_configure.pl 的文件,然后将两个文件的权限设置为 600 并且将所有者设置为 root。

将以下代码填入 nginx_prepare.sh

#!/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/libjemalloc.so' ]; then
    wget -O jemalloc-5.2.1.tar.bz2 ${download_Url}/src/jemalloc-5.2.1.tar.bz2
    tar -xvf jemalloc-5.2.1.tar.bz2
    cd jemalloc-5.2.1
    ./configure
    make && make install
    ldconfig
    cd ..
    rm -rf jemalloc*
fi

nginx_configure.pl 填入代码

--add-module=/www/server/nginx/src/ngx_devel_kit --add-module=/www/server/nginx/src/lua_nginx_module --with-ld-opt=-ljemalloc

最后在面板升级一下 Nginx,或者终端执行下面命令重新编译 Nginx,之后就可以愉快使用 LuaJIT 了。

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

评论

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×