Building from source

I needed the following development headers:

# apt-get install \
libncurses5-dev \
libpcre3-dev \
libreadline6-dev \
libssl-dev \

When developing web sites with nginx, it's useful to have debug enabled. As normal, I wanted self compiled software to go in/usr/local

$ cd ~/src/ngx_openresty-
$ ./configure --prefix=/usr/local --with-debug

Debugging the srcache storage

Turn on debug in yournginx.conf:

error_log  logs/error.log debug;

Then, you can grep for srcache in the error log (be sure to turn this one off as it'll grow quite large):

$ tail -f logs/error.log
19612#0: *194 srcache_fetch decides to send the response in cache
19612#0: *194 srcache_fetch status line done
19612#0: *194 srcache_fetch header done
19612#0: *199 srcache_fetch: subrequest returned status 404
19612#0: *199 srcache_store bypassed because of unmatched status code 404 with srcache_store_statuses

See all compiled-in features of your nginx

To see all the options that are compiled into your nginx, pass the -V option to the (sbin) binary:

$ nginx -V
nginx version: ngx_openresty/
built by gcc 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)
TLS SNI support enabled
configure arguments:

Confusing srcache error message

I was very confused by this error message in the srcache module:

2012/07/13 12:26:50 [error] 18942#0: *145 srcache_store: skipped
because response body truncated: 54707 > 0 while sending to client,
client:, server: localhost, request: "HEAD /app/sports/
HTTP/1.1", upstream: "", host:

The explanation was simply that the HTTP request was HEAD and the response body naturally was shorter (empty) than the declared content length. How logical everything is when you know the answer...

Licensed under CC BY Creative Commons License ~ ✉ torstein.k.johansen @ gmail ~ 🐘 ~ 🐦 @torsteinkrause