Check apache from command line

When working with web servers we sometimes need to test them and make sure we are getting what we need to get,
and to see what the web server is sending back including headers.
The simplest and fastest way to do that is through command line.

telnet to the web server port – (usually port 80) like this:
telnet yonitg.com 80

and then just paste:
GET / HTTP/1.1
Host: yonitg.com

and press “Enter” twice.

Your output should be something like this:

HTTP/1.1 200 OK
Date: Wed, 11 Mar 2009 00:09:53 GMT
Server: Apache/2.2.11 (Win32) DAV/2 mod_ssl/2.2.11 OpenSSL/0.9.8i mod_autoindex_color PHP/5.2.8 mod_perl/2.0.4 Perl/v5.10.0
Last-Modified: Fri, 21 Dec 2007 02:01:16 GMT
ETag: “200000001d649-ca-441c240f37300″
Accept-Ranges: bytes
Content-Length: 202
Content-Type: text/html

these are standard reply headers from the Apache server on my host,
after the headers you will see the rest of the reply from the web server, in my case:

<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”
http://www.w3.org/TR/html4/loose.dtd“>
<html>
<head>
<title></title>
</head>
<body>
<h1>It works!</h1>
</body>
</html>

This way you don’t need a sniffer installed just to check if the web server is sane.
also from the linux command line you can also test this with:
GET http://yonitg.com
or
POST http://yonitg.com

the GET and POST command line apps are good tools to test http response,
they are part of the libwww-perl package.

Technorati Tags: , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>