Then edit the module configuration file in your favorite text editor. Then add “AddOutputFilterByType DEFLATE application/json” in the deflate module configuration file.

Save your file and restart Apache2 service to apply new settings. All done.