How to check if a web server is installed on a Linux machine?

Good morning,

The main question :-)

  • How to check if a web server is installed on a Linux machine? I do not know if any web server is installed or not. If it is installed, I would like to use it to create a website providing services.

  • If a web server is installed, how to check where it is installed, path, properties, etc.

Thank you for your time!

+8
linux webserver
source share
2 answers

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.

+12
source share

Take Apache HTTP Server as an example, there is a ServerSignature directory call

Check with HTTP response header Maybe something like

 Server: Apache/2.2.17 (Win32) PHP/5.2.17 

Of course, the server can disable this feature.

You can try the Firefox Web Developer add-ons to get these HTTP headers

The best way to check the operating system is to find the server host, get the user account and login :-)

For your second question, please log in and find the assigned tutorial for this OS

0
source share

All Articles