Use nginx to call shell script - simplest way?

agentzh agentzh at
Thu Mar 10 06:53:09 MSK 2011

On Thu, Mar 10, 2011 at 3:15 AM, Richard Kearsley
<Richard.Kearsley at> wrote:
> Can't get much simpler than that lua example...

Heh :)

> Agentzh, I'm not too familiar with lua but your module helped me do something really
> important that I needed.

Oh, my pleasure ;)

(BTW, please do *not* capitalize my nick. it makes me feel uncomfortable ;))

> Is that os.execute a lua feature or an nginx_lua feature?

It's a standard Lua feature. The "os" package is a standard one.

>  I'm sure there are a lot more ways it can be useful. Any plans to post up more examples that would suprise us with what's possible?

In our production web sites, we're using ngx_lua to do full server
side web application development. It issues nginx subrequests to
internal nginx locations configured by ngx_drizzle, ngx_memc,
ngx_redis2, ngx_proxy (and many other upstream modules) to fire out
non-blocking queries to our (big) mysql clusters, memcached clusters,
tokyotyrant clusters, redis clusters, Taobao Open Platform (TOP) web
services, and many other internal backends.

We also intergrate our full-fledged SQL engine written in pure Lua
into nginx (by means of ngx_lua) to do complex relational data mash-up
of various different data-sources directly in memory. And we invented
LZSQL [1] which is a high-level language for abstracting away the
difference between SQL requires running remotely (i.e., in a mysql
node) and SQL queries running locally (i.e., directly within the nginx
core). Most of our business logic for data products is written in


[1] See

More information about the nginx mailing list