how to get nginx version by shell script?

Edho P Arief edhoprima at
Mon Feb 14 12:37:26 MSK 2011

On Mon, Feb 14, 2011 at 4:25 PM, licess <licess at> wrote:
> i have try to get nginx version,use:
> root at vps:~# nv=`/usr/local/nginx/sbin -v`
> root at vps:~# echo $nv

perhaps you meant `/usr/local/sbin/nginx -v`?

Also the output is directed to stderr (don't ask me why) so you need 2>&1

nv=`/usr/local/sbin/nginx -v 2>&1`
echo $nv

More information about the nginx mailing list