Adding ngx_lua to nginx

Discussion in 'Tips/Tricks/Mods' started by Kubek, May 19, 2013.

  1. Kubek

    Kubek New Member

    Hi, I just followed the The Perfect Server - Debian Wheezy (nginx, BIND, Dovecot, ISPConfig 3).

    Now I wonder how can I add the ngx_lua module to nginx.
    I want to implement advanced caching mechanism right in nginx.

    I think I need to recompile the nginx with ngx_lua module but i am not sure how can i do it. I do not want to break anything. So far I found these instructions, but I don't know where nginx have to be installed.

    Thank you for help :)
     
    Last edited: May 19, 2013
  2. Kubek

    Kubek New Member

    How to

    I finally done it. Only few seconds downtime.
    So here are some instructions for other people

    1. Download and install LuaJIT:

    Code:
    cd /tmp
    wget http://luajit.org/download/LuaJIT-2.0.1.tar.gz
    tar -xzvf LuaJIT-2.0.1.tar.gz
    cd LuaJIT-2.0.1.tar.gz
    make && sudo make install
    
    It will automatically install LuaJIT to /usr/local/

    2. Download the latest version of the ngx_devel_kit (NDK) module:
    Code:
    cd /tmp
    wget https://github.com/simpl/ngx_devel_kit/archive/v0.2.18.tar.gz
    tar -xzvf v0.2.18.tar.gz
    
    3. Download the latest version of ngx_lua:
    Code:
    cd /tmp
    wget https://github.com/chaoslawful/lua-nginx-module/archive/v0.8.2rc1.tar.gz
    tar -xzvf v0.8.2rc1.tar.gz
    
    4. Download the latest version of Nginx:
    Code:
    cd /tmp
    wget http://nginx.org/download/nginx-1.4.1.tar.gz
    tar -xzcf nginx-1.4.1.tar.gz
    
    5. Prepare Nginx with module
    Code:
    cd nginx-1.4.1.tar.gz
    //Add here everything you have in nginx -V
    ./configure --add-module=/path/to/ngx_devel_kit
    ./configure --add-module=/path/to/lua-nginx-module
    
    6. Stop Nginx, install, Start new Nginx:
    Code:
    make
    nginx -s stop
    nginx make install
    nginx
    
    Enjoy your new Nginx.

    *AUTOMATIC UPDATES CAN BREAK YOUR NGINX
     

Share This Page