Skip to content

Instantly share code, notes, and snippets.

@justqyx
Forked from jugyo/gist:3882497
Created July 13, 2016 12:54
Show Gist options
  • Save justqyx/9a100165a8cb05b8b95140ef2fbf06d7 to your computer and use it in GitHub Desktop.
Save justqyx/9a100165a8cb05b8b95140ef2fbf06d7 to your computer and use it in GitHub Desktop.
nginx + ngx_lua on Mac

Installation

http://wiki.nginx.org/HttpLuaModule#Installation

install LuaJIT

$ brew install luajit

download ngx_devel_kit

$ cd /usr/local/src
$ git clone https://github.com/simpl/ngx_devel_kit.git

download lua-nginx-module

$ cd /usr/local/src
$ git clone https://github.com/chaoslawful/lua-nginx-module.git

add configure options (via brew edit nginx)

--add-module=/usr/local/src/ngx_devel_kit
--add-module=/usr/local/src/lua-nginx-module

compile nginx

$ export LUAJIT_LIB=/usr/local/Cellar/luajit/2.0.0-beta10/lib
$ export LUAJIT_INC=/usr/local/Cellar/luajit/2.0.0-beta10/include/luajit-2.0
$ brew install nginx

Tips

logging

ngx.log(ngx.ERR, "foo")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment