While working on setting up a new QA environment, I realized that I needed to make sure the version and exact configuration matched our development environment. So how do you check that?

First, you'll need to make sure you know where nginx is installed -- for me, it was under

        /usr/local/nginx/
    

but it could be different for you. You might be able to use which nginx to find it if you've installed using a package, but in my case I had compiled it from scratch so I could include ngx_pagespeed. So a quick

        ps -ef | grep nginx
    

showed me where it had launched from.

To simply display the nginx version, you can use this, adjusting the path for your own system:

/usr/local/nginx/sbin/nginx -v

Which will display something like this:

If you want to also show the configure options, however, you'll want to use the -V option with a capital letter.

/usr/local/nginx/sbin/nginx -V

This will give you the full configure options command line, which you can then use to recompile the exact same version of nginx on another box.

Of course, you'll want to pay close attention to the modules, because you'll probably have to download them.