If the web server is active, itβs easy enough to tell, but if the web server is installed but not active, itβs more difficult, since there are probably a dozen different web servers that can be installed (but not started). You can tell if the web server is active on the default port for http (80) with:
$ telnet hostname 80
Where hostname is the host name or IP address of the machine of interest. If you have access to the shell for the machine of interest, you can simply use localhost , for example, if the web server is active, you will see something like:
$ telnet localhost 80 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'.
If you type something like:
GET /foo
An error message appears that may tell you which web server is installed. For example:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>404 Not Found</title> </head><body> <h1>Not Found</h1> <p>The requested URL /status was not found on this server.</p> <hr> <address>Apache/2.2.22 (Ubuntu) Server at 127.0.1.1 Port 80</address> </body></html> Connection closed by foreign host.
This will tell you that Apache version 2.2.22 is installed and running on the computer on which the shell is running.
If there is no active web server, on the other hand, you will see something like:
$ telnet localhost 80 Trying 127.0.0.1... telnet: Unable to connect to remote host: Connection refused
In this case, everything becomes more specific for distribution (what you find and where it depends on the installed Linux distribution). You can check if the web server is installed but not active by checking for common service names or installed files and directories. You can try:
$ service apache2 status
or
$ service httpd status
And you can get:
Apache2 is NOT running.
This at least tells you that Apache is installed but not working, whereas:
apache2: unrecognized service
... will tell you that Apache is not installed. However, another web server may be installed.
You can also check if there is a directory /var/www/ or another directory where web servers usually store default files, for example:
$ ls /var/www
Unfortunately, it is difficult to give a good answer without knowing which distribution (e.g., Debian, Ubuntu, RedHat, CentOS, Fedora, ...) is installed on the machine of interest.