How do I enable compression for Nginx?
gzip is not enabled by default in the Nginx configuration. To enable it, modify the
/etc/nginx/nginx.conf file directly and add this line:
By default, Nginx compresses responses only with MIME type
text/html. To compress responses with other MIME types, include the
gzip_types directive and list the additional types (for additional mime types, see this page):
gzip_types text/plain application/xml;
The overall configuration of gzip compression might look like this:
Once this is completed, restart the services.
Note: Your configuration requirements may differ, and the above is a general example. For additional information, review the official Nginx documentation.