Good morning folks,
Basic question :-)
How to check if a web server is installed in a Linux machine? I dont know if any web server installed or not. If installed I would like to use it to build a web service.
If a web Server installed, how to check where it is installed, path , properties etc..
Thank you for your time!
Another quick way to see if you are running a rogue Web server is to go to a command prompt and type netstat -na. On the second line you can see that you have TCP port 80 LISTENING. This means that you are using the HTTP service on your machine, which again, indicates that you have a Web server running.
The ping command is a simple network utility command-line tool in Linux. It's a handy tool for quickly checking a host's network connectivity. It works by sending an ICMP message ECHO_REQUEST to the target host. If the host reply with ECHO_REPLY, then we can safely conclude that the host is available.
If there's a webserver active it's easy enough to tell, but if the webserver is installed, but not active, it's more difficult, since there are probably a dozen different webservers that might be installed (but haven't been started). You can tell if there's a web server active on the default port for http (80) with:
$ telnet hostname 80
Where hostname
is the hostname or IP address of the machine of interest. If you have shell access to the machine of interest, then you can just use localhost
, for example, if there is a webserver 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
You will get an error message that may tell you something about what webserver 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 would tell you that Apache version 2.2.22 is installed and running on the machine that you're running the shell on.
If there is no webserver active, 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, things get rather more distribution-specific (what you find and where is dependent on the Linux distribution installed). You can try to see if there's a webserver installed, but not active, by checking for common service names or installed files and directories. You could try:
$ service apache2 status
or
$ service httpd status
And you might get:
Apache2 is NOT running.
This at least tells you that Apache is installed, but not running, whereas:
apache2: unrecognized service
... would tell you that Apache is not installed. There could, however, be another webserver installed.
You might also check to see if there's a /var/www/
directory, or another directory where webservers commonly store files by default, e.g.:
$ ls /var/www
Unfortunately, it's hard to give a good answer without knowing what distribution (e.g. Debian, Ubuntu, RedHat, CentOS, Fedora, ...) is installed on the machine of interest.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With