others-how to check if nginx support a module

1. Purpose

In this post, I would demonstrate how to check if nginx support a module.

2. The solution

$ nginx -V 2>&1 | grep --color -- <module_build_option>

For example, check if nginx support http stub status module.

$ nginx -V 2>&1 | grep --color -- --with-http_stub_status_module

What does nginx -V 2>&1 mean?

2 refers to the second file descriptor of the process, i.e. stderr.

> means redirection.

&1 means the target of the redirection should be the same location as the first file descriptor, i.e. stdout.

So > /dev/null 2>&1 first redirects stdout to /dev/null and then redirects stderr there as well. 

So this option effectively silences all output (regular or error) from the command.

3. Summary

In this post, I demonstrated how to print the nginx supported modules . That’s it, thanks for your reading.