Showing posts with label Check httpd status in command line. Show all posts
Showing posts with label Check httpd status in command line. Show all posts

Monday, April 1, 2013

Check the httpd status using curl


Check the  httpd status using curl

[root@test]# curl -I http://yahoo.com
HTTP/1.1 301 Redirect
Date: Sat, 09 Mar 2013 05:52:09 GMT
Connection: close
Server: YTS/1.20.13
Cache-Control: no-store
Content-Type: text/html
Content-Language: en
Location: http://www.yahoo.com/
Content-Length: 211

[root@test]# curl -I http://yahoo.com | grep HTTP
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0   211    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
HTTP/1.1 301 Redirect
[root@test]# curl -Is http://yahoo.com | grep HTTP
HTTP/1.1 301 Redirect
[root@test]# curl -Is http://gmail.com
HTTP/1.0 403 Forbidden
Content-type: text/html; charset=UTF-8

[root@test Downloads]# curl -Is http://facebook.com
HTTP/1.0 403 Forbidden
Content-type: text/html; charset=UTF-8

[root@test]# curl -Is http://facebook.com | grep HTTP
HTTP/1.0 403 Forbidden
[root@test]# curl -Is https://facebook.com | grep HTTP
[root@test]# curl -Is http://google.com | grep HTTP
HTTP/1.1 301 Moved Permanently
[root@test]# curl -Is http://linkwithlinux.blogspot.in | grep HTTP
HTTP/1.1 200 OK
[root@test]#

Here I -
 -I/--head
              (HTTP/FTP/FILE) Fetch the HTTP-header only! HTTP-servers  feature  the  command  HEAD
              which  this  uses  to get nothing but the header of a document. When used on a FTP or
              FILE file, curl displays the file size and last modification time only.

-s =Silent or quiet mode.

200 status running fine.
301- redirect temporarily,permanent
403 - forbidden