Link to home
Start Free TrialLog in
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?
Avatar of Dr. Klahn
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.
Avatar of Cyber Ninja

ASKER

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

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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