zoukankan      html  css  js  c++  java
  • 安装nginx环境(含lua)时遇到报错ngx_http_lua_common.h:20:20: error: luajit.h: No such file or directory的解决

    下面是安装nginx+lua环境时使用的相关模块及版本,ngx_devel_kit和lua-nginx-module模块用的都是github上最新的模块.并进行了LuaJIT的安装。

      

    #Install nginx by 2019-12-12
    yum -y install gcc gcc-c++ autoconf automake  
    yum -y install zlib zlib-devel openssl openssl-devel pcre pcre-devel
    useradd  -s /sbin/nologin   -M   nginx
    cd /usr/local/src
    wget http://nginx.org/download/nginx-1.14.2.tar.gz
    wget http://luajit.org/download/LuaJIT-2.1.0-beta3.tar.gz
    wget https://github.com/simpl/ngx_devel_kit/archive/v0.3.0.tar.gz
    wget https://github.com/openresty/lua-nginx-module/archive/v0.10.14.tar.gz
    wget http://luajit.org/download/LuaJIT-2.1.0-beta3.tar.gz
    git clone git://github.com/yzprofile/ngx_http_dyups_module.git
    tar zxf v0.3.0.tar.gz
    tar zxf LuaJIT-2.1.0-beta3.tar.gz
    tar zxf v0.10.14.tar.gz
    tar zxf nginx-1.14.2.tar.gz
    yum -y  install lua-devel
    cd LuaJIT-2.1.0-beta3
    make && make install
    cd ..
    cd nginx-1.14.2
    
    ./configure --prefix=/usr/local/nginx --sbin-path=/usr/bin/nginx   --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module  --with-pcre --with-http_stub_status_module  --with-http_addition_module --with-http_gzip_static_module  --with-file-aio --with-http_dav_module --add-module=../ngx_devel_kit-0.3.0 --add-module=../lua-nginx-module-0.10.14 --add-module=../ngx_http_dyups_module
    make
    make install
    

      

    [root@lua src]# ll
    total 3520
    -rw-r--r--  1 root  root     1213 Dec 12 17:12 install-nginx.sh
    drwxr-xr-x  6 nginx nginx     100 May  2  2017 LuaJIT-2.1.0-beta3
    -rw-r--r--  1 root  root  1025180 May  2  2017 LuaJIT-2.1.0-beta3.tar.gz
    drwxrwxr-x 10 root  root      225 Feb 24  2019 lua-nginx-module-0.10.14
    -rw-r--r--  1 root  root   829900 Dec 12 17:23 lua-nginx-module-master.zip
    drwxr-xr-x  9  1001  1001     186 Dec 12 16:57 nginx-1.14.2
    -rw-r--r--  1 root  root  1015384 Dec  4  2018 nginx-1.14.2.tar.gz
    drwxrwxr-x  9 root  root      221 May 10  2016 ngx_devel_kit-0.3.0
    drwxr-xr-x  4 root  root      187 Dec 12 17:04 ngx_http_dyups_module
    -rw-r--r--  1 root  root   654097 Dec 12 16:56 v0.10.14.tar.gz
    -rw-r--r--  1 root  root    66455 Dec 12 16:56 v0.3.0.tar.gz
    

      .configure执行是成功的,但是在进行make的时候遇到报错:ngx_http_lua_common.h:20:20: error: luajit.h: No such file or directory,详细报错内容如下:

    In file included from ../lua-nginx-module-0.10.15/src/ngx_http_lua_script.h:11:0,
                     from ../lua-nginx-module-0.10.15/src/ngx_http_lua_script.c:13:
    ../lua-nginx-module-0.10.14/src/ngx_http_lua_common.h:20:20: fatal error: luajit.h: No such file or directory
    #include <luajit.h>
                        ^
    compilation terminated.
    make[1]: *** [objs/addon/src/ngx_http_lua_script.o] Error 1
    make[1]: Leaving directory `/usr/local/src/nginx-1.14.2'
    make: *** [build] Error 2
    

     

    解决方法:把lib的路径写入/etc/profile中
    # vim /etc/profile
    export LUAJIT_LIB=/usr/local/lib
    export LUAJIT_INC=/user/local/include/luajit-2.1
    # source /etc/profile
    

     重新编译即可成功! 

     

    [root@lua src]# nginx
    nginx: error while loading shared libraries: libluajit-5.1.so.2: cannot open shared object file: No such file or directory
    [root@lua src]# find / -name libluajit-5.1.so.2
    /usr/local/lib/libluajit-5.1.so.2
    [root@lua src]# ln -s /usr/local/lib/libluajit-5.1.so.2 /lib64/libluajit-5.1.so.2
    [root@lua src]# nginx -V
    nginx version: nginx/1.14.2
    built by gcc 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC)
    built with OpenSSL 1.0.2k-fips  26 Jan 2017
    TLS SNI support enabled
    configure arguments: --prefix=/usr/local/nginx --sbin-path=/usr/bin/nginx --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-pcre --with-http_stub_status_module --with-http_addition_module --with-http_gzip_static_module --with-file-aio --with-http_dav_module --add-module=../ngx_devel_kit-0.3.0 --add-module=../lua-nginx-module-0.10.14 --add-module=../ngx_http_dyups_module
    

      

     

     

  • 相关阅读:
    mongodb修改和删除操作
    mongodb常用查询语句
    ejs常用功能函数
    Rails + React +antd + Redux环境搭建
    nodejs安装和卸载
    Git 建立仓库及常用命令速查表
    使用MVC5+Entity Framework6的Code First模式创建数据库并实现增删改查功能
    gem devise配置
    Ubuntu16.04安装postgresql9.4及pgadmin3图形管理界面
    Rails Migration Data Model栏位修改及数据类型介绍
  • 原文地址:https://www.cnblogs.com/putihuakai/p/12030901.html
Copyright © 2011-2022 走看看