3
votes

I am trying to determine if someone is running Nginx, Apache, Lighttpd or another webserver in PHP.

I tried this with the predefined $_SERVER variable, but I am not sure if and how this will work since I have only been able to test this on Apache 2.4. Does anyone have an idea on how I can determine what webserver someone is using?

2
What problem will knowing what webserver they use solve? - Quentin

2 Answers

4
votes

If the webserver is not configured to hide server name, then you can determine server name by

<?php
   echo $_SERVER['SERVER_SOFTWARE'];
?>

1) Apache cannot be directly configured to hide server name, But it can be achieved by installing mod-security

2)nginx and lighttpd can be easily configured to hide server fingerprinting.

1
votes
<?php
echo $_SERVER['SERVER_SOFTWARE'];