gzip
Read or set gzip compression in the Nginx configuration (on, off, or default)
- Command:
/go/gzip - Category: Web server
- Required option: None
- Output: The current value, or the result of the reload
- Last updated: 2026-11-20
On this page: Overview · Quick start · Syntax · Options · Output · Examples · Troubleshooting · Details · See also
Overview
gzip makes the web server compress the pages it sends, which saves bandwidth and makes sites load faster. /go/gzip shows or changes the gzip setting in /etc/nginx/nginx.conf and then reloads the web server with reload.
The command works on Nginx only. Apache servers use their own compression module (mod_deflate), which this command doesn't change.
Quick start
# Show the current setting
/go/gzip return
# Turn compression on
/go/gzip on
Syntax
/go/gzip
/go/gzip <on|off|default>
/go/gzip return
Options
| Argument | Effect |
|---|---|
| (none) | Asks for a value. The current value is filled in, so press Enter to keep it. |
on |
Sets gzip on;. |
off |
Sets gzip off;. |
default |
Sets gzip on;. Note that this is GoAdmio's default, not Nginx's own default, which is off. |
return |
Prints the current value and exits without changing anything. |
[!WARNING] Any other value is written to the file as it is. Nginx accepts only
onandoffforgzip, so anything else makes the configuration invalid and the reload fails.
Output
With return, the command prints the current value:
on
When it changes the setting, the output comes from the reload command that runs afterwards.
| Outcome | What you get |
|---|---|
| Value changed | The setting is rewritten and the web server is reloaded. |
return |
The current value. |
No gzip line in nginx.conf |
gzip not exists. Exit status 1. |
Examples
# Show the current setting
/go/gzip return
# Turn compression on
/go/gzip on
# Use GoAdmio's default (on)
/go/gzip default
# Turn compression off, for example when a CDN already compresses the pages
/go/gzip off
# Change it interactively
/go/gzip
# Check that pages are compressed
curl -sI -H "Accept-Encoding: gzip" https://example.com | grep -i content-encoding
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
gzip not exists. |
/etc/nginx/nginx.conf has no gzip line, or the line is commented out (#gzip on;). |
Add gzip on; inside the http { } block, or remove the #, then run the command again. |
| Only HTML pages are compressed | By default, Nginx compresses only text/html when gzip on; is set. CSS, JavaScript, and JSON need a gzip_types line. |
Add a gzip_types line to nginx.conf, then reload. |
| The reload fails after a change | The value isn't on or off. |
Set on or off, and check the file with nginx -t. |
| Nothing changes on an Apache server | The command only changes Nginx. | Configure mod_deflate for Apache. |
content-encoding is missing in the test |
The page type isn't compressed, the response is very small, or a proxy removed it. | Test with a larger HTML page. |
Details
- Reads the
gzipvalue from/etc/nginx/nginx.conf. - For a new value, rewrites the line as
gzip <value>;. - Reloads the web server with
reload.
The reload also reloads PHP-FPM. To restart the web server instead, see web.
| Item | Used for |
|---|---|
/etc/nginx/nginx.conf |
The file that holds the gzip setting. |
See also
| Command | Description |
|---|---|
nginx |
Convert a GoAdmio server from Apache to Nginx |
apache |
Convert a GoAdmio server from Nginx to Apache |
reload |
Reload PHP-FPM and the active web server |
web |
Restart or reload the active web server |
keepalive |
Read or set Apache's KeepAlive directive |
keepalivetimeout |
Read or set Apache's KeepAliveTimeout directive |
maxkeepaliverequests |
Read or set Apache's MaxKeepAliveRequests |