nginx:enable_gzip_compression
Differences
This shows you the differences between two versions of the page.
nginx:enable_gzip_compression [2017/02/22 14:26] – created peter | nginx:enable_gzip_compression [2019/12/01 10:33] (current) – removed peter | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== nginx - Certificate installation ====== | ||
- | |||
- | Edit the Nginx config file, and fine the gzip section. | ||
- | |||
- | <file bash / | ||
- | . . . | ||
- | ## | ||
- | # `gzip` Settings | ||
- | # | ||
- | # | ||
- | gzip on; | ||
- | gzip_disable " | ||
- | |||
- | gzip_vary on; | ||
- | gzip_proxied any; | ||
- | gzip_comp_level 6; | ||
- | gzip_buffers 16 8k; | ||
- | gzip_http_version 1.1; | ||
- | gzip_min_length 256; | ||
- | gzip_types text/plain text/css application/ | ||
- | . . . | ||
- | </ | ||
- | |||
- | <WRAP info> | ||
- | Nginx can use gzip to compress files it serves on the fly. Those files are then decompressed by the browsers that support it upon retrieval with no loss whatsoever, but with the benefit of smaller amount of data being transferred between the web server and browser. | ||
- | |||
- | The **gzip_types** tells Nginx to compress a variety of different file tyoes. | ||
- | </ | ||
- | |||
- | |||
- | If any changes have been made to the configuration file, then to enable the new configuration, | ||
- | |||
- | <code bash> | ||
- | sudo systemctl reload nginx | ||
- | </ | ||
- | |||
- | |||
- | ===== Check if gzip compression is being used ===== | ||
- | |||
- | Execute the following command: | ||
- | |||
- | <code bash> | ||
- | curl -H " | ||
- | </ | ||
- | |||
- | This should display several HTTP response headers: | ||
- | |||
- | < | ||
- | you should see several HTTP response headers: | ||
- | |||
- | Nginx response headers | ||
- | HTTP/1.1 200 OK | ||
- | Server: nginx/1.4.6 (Ubuntu) | ||
- | Date: Tue, 19 Jan 2016 20:04:12 GMT | ||
- | Content-Type: | ||
- | Last-Modified: | ||
- | Connection: keep-alive | ||
- | Content-Encoding: | ||
- | </ | ||
- | |||
- | In the last line, you can see the **Content-Encoding: | ||
nginx/enable_gzip_compression.1487773569.txt.gz · Last modified: 2020/07/15 09:30 (external edit)