私は次のことを行う方法を理解しようとしています:
リクエストが来ています。
HttpLuaModule
リクエストに対して何らかのアクションを実行します。リクエストが有効な場合、Lua は で処理を終了しngx.exit(202)
ます。ただし、処理中に発生する可能性があり、発生するnginx
可能性があり、 403 、 404 、 503 エラーを返す可能性のある条件がいくつかあります。
私がやりたいことは、200 ステータス コードを持つリクエストのみにアクセス ログに書き込むことです。基本的に私はこのようなことをしたいと思います:
location /foo {
content_by_lua_file "/opt/nginx/lua/process.lua";
if (status == 200) {
access_log "/path/to/the/access_log"
}
私はnginxとluaの両方に非常に慣れていないので、どこに配置するか、ifステートメントを配置する場所(イーサの後content_by_lua_file
またはサイドluaファイル内)、およびこのifステートメントがどのように見えるかを理解するのは少し難しいです。