SoFunction
Updated on 2025-04-12

nginx: Implementation of the method of viewing version number

In Nginx, to view the detailed version number, you can use the following methods:

Use nginx -v command

 Open the terminal or command line interface and enter the following command:

nginx -v

This command will output the version number of Nginx, for example:

nginx version: nginx/1.18.0

Use nginx -V command

Enter the following command:

nginx -V

This command will not only display the version number of Nginx, but also display the parameters used when compiling Nginx, for example:

nginx version: nginx/1.18.0
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC) 
built with OpenSSL 1.0.2k-fips  26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib/nginx/modules --conf-path=/etc/nginx/ --error-log-path=/var/log/nginx/ --http-log-path=/var/log/nginx/ --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --lock-path=/var/lock/ --pid-path=/run/ --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-http_auth_request_module --with-mail --with-mail_ssl_module --with-file-aio --with-http_v2_module --with-stream_realip_module --with-stream_ssl_module --with-stream --with-stream_ssl_preread_module --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fPIC' --with-ld-opt='-Wl,-z,relro -Wl,--as-needed'

View /usr/share/doc/nginx/README file (if present)

In some Linux distributions, Nginx version information may also be included in the README file in the installation directory. You can use the following command to view:

cat /usr/share/doc/nginx/README

View version information in /etc/nginx/ file (if configured)

Although this is not a way to get the version number directly, sometimes developers will add version information as comments in the configuration file. You can view the configuration file:

cat /etc/nginx/ | grep 'version'

Use dpkg or rpm (depending on your Linux distribution)

If you are using a Debian-based system (such as Ubuntu), you can use:

dpkg -l | grep nginx

For RPM-based systems (such as CentOS), you can use:

rpm -qi nginx

These commands will provide more detailed information about the Nginx package, including version numbers.

This is the end of this article about the implementation of nginx's version number. For more related nginx's version number content, please search for my previous articles or continue browsing the related articles below. I hope everyone will support me in the future!