1. 下载安装LuaJIT
    cd /usr/local/src
    sudo wget http://luajit.org/download/LuaJIT-2.0.3.tar.gz
     tar -xzvf LuaJIT-2.0.3.tar.gz 
     cd LuaJIT-2.0.3/
    sudo make
    # 如果出现OK        Successfully built LuaJIT   则说明编译成功
    sudo make install
    #如果出现“==== Successfully installed LuaJIT 2.0.3 to /usr/local ====”则说明安装成功
    

     

  2. 下载准备nginx lua模块 

    sudo wget https://github.com/chaoslawful/lua-nginx-module/archive/v0.8.6.tar.gz
    tar -xzvf v0.8.6.tar.gz 
    

     

  3. 安装nginx

    sudo wget http://nginx.org/download/nginx-1.6.2.tar.gz
    sudo tar -xzvf nginx-1.6.2.tar.gz 
    cd nginx-1.6.2/
    # 先导入环境变量,告诉nginx去哪里找luajit
    tp@IdeaPad:/usr/local/src/nginx-1.6.2$ export LUAJIT_LIB=/usr/local/lib
    tp@IdeaPad:/usr/local/src/nginx-1.6.2$ export LUAJIT_INC=/usr/local/include/luajit-2.0