OpenResty
インストール on macOS
code:sh
xcode-select --install # 必要であれば
brew tap openresty/brew
brew install openresty
code:brew log
To have launchd start openresty/brew/openresty now and restart at login:
brew services start openresty/brew/openresty
Or, if you don't want/need a background service you can just run:
openresty
openresty-openssl is keg-only, which means it was not symlinked into /usr/local,
because only for use with OpenResty.
If you need to have openresty-openssl first in your PATH run:
echo 'export PATH="/usr/local/opt/openresty-openssl/bin:$PATH"' >> ~/.zshrc
For compilers to find openresty-openssl you may need to set:
export LDFLAGS="-L/usr/local/opt/openresty-openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openresty-openssl/include"
For pkg-config to find openresty-openssl you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/openresty-openssl/lib/pkgconfig"
==> openresty
To have launchd start openresty/brew/openresty now and restart at login:
brew services start openresty/brew/openresty
Or, if you don't want/need a background service you can just run:
openresty
確認
$ resty -e 'print("hello, world!")'
バンドルされたモジュールのリスト
location ディレクティブは、コンテンツハンドラーとなり、nginxでコルーチンとして扱われ、メインループに影響しない。
set_by_lua はイベントループ内で実行されるので、重い処理はダイレクトにパフォーマンスを悪化させる。
ngx と ndk は _by_lua ディレクティブの内部でいつでもアクセス可能。標準モジュール的扱い。
ngx.location.capture は、 locationディレクティブ内の luaコードから、別の locationディレクティブを呼び出した結果を取得できる。
Nginxチュートリアル
逆引きlua-nginx-module
ハイパフォーマンスngx_lua
OpenResty (nginx + lua) 逆引きメモ
Definitely an openresty guide
https://openresty.org/images/logo.png