NGINX & LUA

Response body logging

We've switched recently to nginx as our main web server. For debugging purpose we needed to log the response body.

If you search across the web, you will find the LUA module for nginx. Most pages explan to download the source for nginx and luajit and configure it. There is even an easier way to do it on Ubuntu, especially when you already use the nginx package.

On Ubuntu 14.04 LTS, nginx comes in version 1.4.6. To install nginx with lua enabled, install nginx-extras.

// run only if you have nginx already instaled
sudo apt-get remove nginx-common

// install the exact version
sudo apt-get install nginx-common=1.4.6-1ubuntu3

// install nginx plus the extras
sudo apt-get install nginx-extras

HttpLuaModule
NGINX config to log the response body

Tags: 
ubuntu
server
nginx