Avatar of Cyber Ninja
Cyber Ninja
 asked on

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

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

Avatar of undefined
Last Comment
noci

8/22/2022 - Mon
Dr. Klahn

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.
Cyber Ninja

ASKER
@Dr. Klahn how do i request a non existent page? I don't understand your answer
ASKER CERTIFIED SOLUTION
David Johnson, CD

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
noci

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

This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23