Перейти к содержанию

Source Code Tricks

Useful commands for exploring the NGINX source code.

All Directives in Server Context

find src/ -type f -name "*.c" -exec grep -B1 NGX_HTTP_SRV_CONF {} \; | \
    grep ngx_string | cut -d\" -f2

All Variables in HTTP Context

find src/ -type f -name "*.c" -exec grep -B2 NGX_HTTP_VAR {} \; | \
    grep ngx_string | cut -d\" -f2

All Module Names

grep -r "ngx_module_t" src/ --include="*.c" | grep "ngx_.*_module ="

Search for Directive Handler

grep -r "ngx_command_t" src/ --include="*.c" -A5 | grep "directive_name"