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: , ,

Why I love Linux

Hi All,
after many years in the job – Linux System Admin that is,
I’ve decided to start my own spot in the net with a collection of solutions I found to various Linux questions.
starting with Windows NT admin way back then, moving to Linux was scary at the beginning, but with each passing day,
I learned that I love Linux much much more,
especially because you can solve each issue in so many different ways,
i can think of at least 5 ways to create a redirect in the web environment using php, apache, html, or plain simple link in command line. And that’s without giving it a lot of thought.

Well here goes – welcome to my blog, and i hope you find help here!!

Technorati Tags: