How do I enable compression for Nginx?
We provide the
ea-nginx-gzip package to enable gzip compression in NGINX. If you install this package, it enables gzip globally.
You can use the
/etc/nginx/conf.d/gzip.conf configuration file to configure your gzip installation. For more information about configuring gzip, read the NGINX gzip module documentation.
If you use gzip compression with SSL/TLS requests, your compressed responses may be vulnerable to BREACH attacks.
To lower the risk of this type of attack, you can perform one of the following actions:
- Do not send sensitive data in your HTTP responses.
- Limit your responses to only use secure samesite cookies.
- cPanel’s Optimize Website interface (cPanel >> Home >> Software >> Optimize Website) does not work with NGINX. Any changes you make there do not effect your gzip compression settings.
- Note: Your configuration requirements may differ, and the above is a general example. For additional information, review the official cPanel nginx documentation.