LoginSignup
40
32

More than 5 years have passed since last update.

Nginxのgzipが動いているか確認する方法 ~ クライアントサイド~

Posted at

Webリクエストはサーバーサイドで、gzipで圧縮されて、クライアントで展開する。
これにより、サーバー、クライアント両サイドで、通信速度、使用帯域を有効活用している。

さらに詳しく:
http://en.wikipedia.org/wiki/HTTP_compression

サーバーサイドでは、例えば、Nginxで

gzip on;

gzip_static モジュールで、gzipを有効にして対応します。

gzip_static on;
gunzip on;

さらに詳しく:
http://qiita.com/cubicdaiya/items/2763ba2240476ab1d9dd
http://nginx.org/en/docs/http/ngx_http_gzip_static_module.html

実際、クライアントサイドでちゃんとgzipで受け取って解凍しているかを確認してみるには、Curlをつかって、Headerで、gzip, deflateを受け取れることを明示し、リクエストを行います。

$curl -I -H 'Accept-Encoding: gzip,deflate' http://example.com/app.js

レスポンスHearderに、 Content-Encoding: gzip があれば動いています。

動いている時
Screen Shot 0027-03-05 at 10.56.21.png

動いていない時
Screen Shot 0027-03-05 at 13.37.22.png

40
32
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
40
32