How To Find Out Nginx Version using command line

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

Tutorial details
Difficulty level Easy
Root privileges No
Requirements None
Est. reading time N/A
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:

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

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 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:

Option Description
-?,-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.

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 1 comment so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
1 comment… add one
  • iPs Jan 4, 2012 @ 18:44

    To check NGINX Version:
    sudo nginx -v
    sudo nginx -V

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum