How To Find Out Nginx Version using command line

last updated in Categories , , ,

How do I print Nginx web server version using command line option under Unix like operating systems? How do I check nginx version?

This quick tutorial explains how to check nginx version using the command line option running on Linux or Unix-like operating systems.


How to find out Nginx version

You can pass the -v or -V option to display nginx web server version. The syntax is:
nginx -v
Sample outputs:

nginx version: nginx/1.2.3

Check Nginx version command

The -V option shows nginx version, compiler version and configure parameters.
nginx -V
Sample outputs:

nginx version: nginx/1.2.3
built by gcc 4.4.6 20120305 (Red Hat 4.4.6-4) (GCC) 
TLS SNI support enabled
configure arguments: --without-http_autoindex_module --without-http_userid_module --without-http_auth_basic_module --without-http_fastcgi_module --without-http_empty_gif_module --with-poll_module --with-http_stub_status_module --with-http_ssl_module --with-ipv6 --with-http_geoip_module

Here is output from the Ubuntu Linux 16.04 LTS server:
Find Out Nginx Version on Linux or Unix using the CLI

See if Nginx is compiled with a particular module or not

Use the nginx command as follows along with the grep command. Open shell prompt and then type:
nginx -V 2>&1 | grep --color 'module-name'
nginx -V 2>&1 | grep --color -o 'module-name'
# find if geoip2_module compiled or not #
nginx -V 2>&1 | grep --color 'geoip2_module'
# find if realip_module compiled or not #
nginx -V 2>&1 | grep --color 'http_realip_module'
# Check for gunzip_module compiled or not #
nginx -V 2>&1 | grep --color -o 'http_gunzip_module'

Sample outputs:


What to do if I get nginx command not found error?

Check for nginx path using the [nixmd name=”which”]/whereis command, run:
whereis nginx
which nginx

Look for nginx binary on your Linux or Unix system using PATH:
echo "$PATH"
Use the ps command to grab path for nginx:
ps aux | grep nginx
Once found use full path:
/usr/sbin/nginx -v
sudo /usr/sbin/nginx -v
sudo /usr/local/sbin/nginx -v

nginx command not found
Dealing with nginx command not found

Find nginx version using the apt-cache command

Are you using a Debian or Ubuntu Linux server? If so, to check the nginx version, you can use the following command too:
$ apt-cache policy nginx

Find Nginx Version - Check Nginx Version Command
Find nginx version running on Ubuntu Linux

How do I install Nginx?

See my previous tutorials:


This page explains how to find out the version of nginx installed on your systems. The binary has following options:

-?,-h this help
-v display nginx version and exit
-V show nginx version and configure options then exit
-t test configuration and exit
-T test configuration, dump it and exit
-q suppress non-error messages during configuration testing
-s signal send signal to a master process: stop, quit, reopen, reload
-p prefix set prefix path (default: /usr/share/nginx/)
-c filename set configuration file (default: /etc/nginx/nginx.conf)
-g directives set global directives out of configuration file

You just learned how to check find nginx web server version using the command line option. For more information see the official nginx webpage here.

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.


1 comment

Leave a Comment