The Nginx version comes up more often than expected: when searching CVEs, writing config syntax for a specific release, upgrading through the package manager, or diagnosing module incompatibility. There are several ways to find it — from a one-liner to reading HTTP response headers.
nginx -v: Short Form
The fastest command — version only, nothing else:
nginx -v
nginx version: nginx/1.24.0
nginx -V: Version Plus Build Parameters
Capital -V gives the full picture — version, compiler, build flags, and the list of compiled-in modules:
nginx -V
This matters when checking whether the installed nginx supports a specific module — for example --with-http_v2_module for HTTP/2 or --with-stream for TCP proxying.
apt / dpkg: Package Version
On Debian and Ubuntu, Nginx is installed through the package manager. The package version may differ from the binary version if nginx was updated manually.
Via apt:
apt show nginx
Via dpkg:
dpkg -l nginx
If nginx-full or nginx-extras is installed:
dpkg -l | grep nginx
On RHEL / CentOS / Rocky:
rpm -q nginx
curl: Version From HTTP Header
If nginx is running and accessible over the network — the version can be read from the response header:
curl -sI http://localhost | grep Server
Server: nginx/1.24.0
The -s flag suppresses the progress bar, -I requests headers only without the response body.
If the server listens on a non-standard port:
curl -sI http://localhost:8080 | grep Server
If the Server header is absent — server_tokens off is enabled. That is intentional version hiding for security. Use nginx -v instead.
systemctl status: Version in Service Output
The service status sometimes shows the version in the unit description:
systemctl status nginx
The version appears in the description line if the package was installed from the official nginx repository. On some distributions this information is not in the status — use nginx -v in that case.
What Version Is Available for Update
Check currently installed and latest available version:
apt list --installed nginx 2>/dev/null
apt list --upgradable 2>/dev/null | grep nginx
If the second command returns a line with nginx — an update is available.
Hiding the Nginx Version
A visible version number in the Server header is a security minus — an attacker immediately knows what to look for in the CVE database. Hide it via config.
Open /etc/nginx/nginx.conf, add inside the http block:
server_tokens off;
Reload the config:
sudo nginx -s reload
After this the Server header returns just nginx with no version number.
Quick Reference
| Task | Command |
|---|---|
| Version only | nginx -v |
| Version + build modules | nginx -V |
| Package version (Debian/Ubuntu) | apt show nginx or dpkg -l nginx |
| Package version (RHEL/CentOS) | rpm -q nginx |
| Version from HTTP header | curl -sI http://localhost | grep Server |
| Service status | systemctl status nginx |
| Available update | apt list --upgradable 2>/dev/null | grep nginx |
| Hide version in header | server_tokens off; in nginx.conf |