Check Nginx version, modules and build options
Inspect the binary without starting it
An Nginx version number identifies the release of a particular binary. Build options describe how that binary was compiled. Two binaries with the same upstream version can support different modules or use different default paths. Begin with read-only discovery.
command -v reports the command selected by your shell if available. Lowercase -v prints the release; uppercase -V adds build details; -h lists options supported by that executable. These actions exit rather than starting a web server. The version output may be written to standard error, so use 2>&1 if you need to capture it together with standard output.
nginx version: nginx/1.26.3configure arguments: --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --with-http_ssl_module --with-stream=dynamicThe excerpt shows a compiled default prefix and configuration path, HTTP TLS support included at build time, and a stream module built for dynamic loading. The stream flag does not establish that the module file is installed or loaded in a particular configuration. TLS support does not mean HTTPS is already configured. The actual local authoring binary reports Nginx 1.26.3; that observation is not a recommendation to deploy that version.
Read build paths, not guesses
The prefix is the base used for many relative server paths. The default configuration path may be compiled separately as an absolute path. The -p and -c switches let you point a lab instance at explicit alternatives. A prefix change alone does not override every absolute build default. A dedicated fixture should specify writable PID, error log, access log and temporary paths itself.
Understand modules and release streams
A statically compiled module is linked into the binary. A dynamic module is loaded from a compatible shared library by configuration when available. For a feature, first check the module documentation, then the binary and package, then the actual approved configuration and a behavior test. Mainline and stable are upstream release streams; mainline is not synonymous with beta. Distribution package revisions, security backports and library versions are separate from the upstream release number.
dpkg-query -W -f='${Package} ${Version}\n' nginxThis reads local package metadata; it does not determine the active service configuration or prove a package is patched. Compare the package revision with the applicable security advisory. If the binary was installed from source or a different package, this query may fail or identify an unrelated package.
nginx -T tests and prints configuration, potentially revealing private paths, credentials or internal endpoints. Use it only for known synthetic files in a later lab. A build flag is not a substitute for checking module loading.
Practice
Given two hypothetical builds of the same version, one with HTTP TLS and the other with a dynamically built stream module, explain which facts are established by the build flags and which require additional evidence. Record the binary version, package revision if available, and configuration path as separate facts.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Version and build inspection
Check the main concepts taught in this lesson.
Which command prints the Nginx build options?
What does --with-stream=dynamic establish in the example?
Which fact is established by --conf-path=/etc/nginx/nginx.conf?
Why is nginx -T inappropriate for an unknown live configuration?
What evidence is needed before claiming a module works for a workload?