What command can i use on a mac terminal to know the version of nginx running on a remote IP address

Cyber Ninja
Cyber Ninja used Ask the Experts™
on
What command can i use on a mac terminal to know the version of nginx running on a remote IP address?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Dr. KlahnPrincipal Software Engineer

Commented:
https://linux-audit.com/hiding-nginx-version-number/

Freely adapted from the above page:

Nginx shows the version number in default error pages and in the headers of HTTP requests. To see this, request a non-existent page on the site or monitor an HTTP transaction to the site.  This is a bad thing to be seen by anyone and it should be disabled.  Set the server_tokens statement to off in the nginx global configuration file.

    # Don’t show the Nginx version number (in error pages / headers)
    server_tokens off;

Open in new window


Restart nginx. Clear the browser's cache.  Request a non-existent page. It should no longer display the Nginx version.

If server_tokens has been disabled, the only way to get that information is to log into the server host and check it by hand.

Author

Commented:
@Dr. Klahn how do i request a non existent page? I don't understand your answer
Top Expert 2016
Commented:
simple in your browsers address bar after the domain and the slash enter whatever strikes your fancy i.e. supercalifragilisticexpialidocious or whatever you want..
nociSoftware Engineer
Distinguished Expert 2018

Commented:
The next should help,  replace the www.example.com to the website  in question

curl -v http://www.example.com/whatever-non_existing/page/you/can/com/up/with/or/something/else/that/is/highly/unlikely/to.exist

Open in new window

Any system admin worth their salt should  have server_tokens disabled.
Bad:
<html>
<head><title>404 Not Found</title></head>
<body>
<center><h1>404 Not Found</h1></center>
<hr><center>nginx/x.y.z</center>
</body>

Open in new window


Good:
<html>
<head><title>404 Not Found</title></head>
<body>
<center><h1>404 Not Found</h1></center>
<hr><center>nginx</center>
</body>
</html>

Open in new window

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial