Testing Apache from the Command Line


$ telnet www.apache.org 80 Trying 192.87.106.226... Connected to ajax-1.apache.org (192.87.106.226). Escape character is '^]'. HEAD / HTTP/1.0 HTTP/1.1 200 OK Date: Sun, 04 Sep 2005 20:42:02 GMT Server: Apache/2.0.54 (Unix) mod_ssl/2.0.54      OpenSSL/0.9.7a DAV/2 SVN/1.2.0-dev Last-Modified: Sat, 03 Sep 2005 11:35:42 GMT ETag: "203a8-2de2-3ffdc7a6d3f80" Accept-Ranges: bytes Content-Length: 11746 Cache-Control: max-age=86400 Expires: Mon, 05 Sep 2005 20:42:02 GMT Connection: close Content-Type: text/html; charset=ISO-8859-1 Connection closed by foreign host.


Because HTTP is a simple text-based protocol, you can use a telnet client, a program that allows you to connect directly to a server and port you specify, to test for the presence of a working Apache server from the command line. If you receive no response to a remote telnet request and are positive that your network is properly configured, Apache is not listening on the address and port in question. This can be useful for troubleshooting in environments where a web browser is not available, as can be the case when accessing a server remotely over SSH. For example, if you can access Apache in a remote machine from the localhost address using telnet, but not remotely using a browser, it may indicate firewall problems or an incorrect setting of the Apache Listen directive.

Connect via telnet to www.apache.org (or your favorite website) at port 80 and type

HEAD / HTTP/1.0


or

GET / HTTP/1.0


Press the Enter key twice. You will get a response similar to the example.

If you have the lynx command-line browser installed in your Unix system, you can get a similar result by issuing the command

lynx head dump http://www.apache.org


Chapter 7 covers mod_ssl and explains a similar way to connect to an SSL-enabled web server using the openssl command-line tool.




Apache(c) Phrase Book(c) Essential Code and Commands
Apache Phrasebook
ISBN: 0672328364
EAN: 2147483647
Year: 2006
Pages: 254

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net