Quantcast
Channel: NETWORK ENGINEER BLOG
Viewing all articles
Browse latest Browse all 266

Telnet を使用した HTTP 確認方法

$
0
0

試験用に Web サーバをインストールします。*1

# yum -y install httpd
# yum -y install php php-mbstring

試験用 Web ページを作成します。

# echo test >> /var/www/html/index.html

Telnet を使用して、Web ページへアクセスします。

# telnet localhost 80
Trying 127.0.0.1...
Connected to localhost.localcomain (127.0.0.1).
Escape character is '^]'.
GET http://localhost/index.html HTTP/1.0

HTTP/1.1 200 OK
Date: Fri, 21 Feb 2014 02:43:08 GMT
Server: Apache/2.2.3 (CentOS)
Last-Modified: Fri, 21 Feb 2014 02:28:46 GMT
ETag: "30313-5-4f2e1619bb380"
Accept-Ranges: bytes
Content-Length: 5
Connection: close
Content-Type: text/html; charset=UTF-8

test
Connection closed by foreign host.

プロキシの試験も可能です。試験用に Squid をインストールします。

# yum -y install squid

試験に必要な必要最低限の設定をします。

# vi /etc/squid/squid.conf
visible_hostname myhost --- 575行目あたり

Squid を起動します。

# /etc/rc.d/init.d/squid start

Telnet を使用して、Squid 経由で Web ページへアクセスします。

[root@myhost ~]# telnet localhost 3128
Trying 127.0.0.1...
Connected to localhost.localcomain (127.0.0.1).
Escape character is '^]'.
GET http://192.168.1.152/index.html HTTP/1.0

HTTP/1.0 200 OK
Date: Fri, 21 Feb 2014 11:28:36 GMT
Server: Apache/2.2.3 (CentOS)
Last-Modified: Fri, 21 Feb 2014 02:34:11 GMT
ETag: "1502d2-5-4f2e174facec0"
Accept-Ranges: bytes
Content-Length: 5
Content-Type: text/html; charset=UTF-8
Age: 1344
X-Cache: HIT from myhost
X-Cache-Lookup: HIT from myhost:3128
Via: 1.0 myhost:3128 (squid/2.6.STABLE21)
Proxy-Connection: close

test
Connection closed by foreign host.

アクセスログから、プロキシ経由となっている事を確認できます。

# tail -f /var/log/squid/access.log
1392982116.127    918 127.0.0.1 TCP_MISS/200 385 GET http://192.168.1.152/index.html - DIRECT/192.168.1.152 text/html
1392982262.706    179 127.0.0.1 TCP_HIT/200 393 GET http://192.168.1.152/index.html - NONE/- text/html

*1:CentOS5.6を使用しています。


Viewing all articles
Browse latest Browse all 266

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>