Correct “Enable text compression” error in Lighthouse & Qualitycs
Transferring data on the web costs time and money, thus it’s important to reduce those data.
If you use Qualitycs (or Lighthouse), you can see the error on this form:
As you can see in the screenshot above, enabling text compression can help increase the load time a lot!
Today, nearly all browsers support text compression. Yet, the server must be configured to send compressed files. This article describes how to enable compression on Nginx and Apache 2.
On Nginx, you need to change only one character to enable text compression.
Open your nginx config file (usually in /etc/nginx/nginx.conf ):
sudo nano /etc/nginx/nginx.conf
In this file, try to find the Gzip section:
1 2 3 4 5 6 7 8 9 10
Lines starting with # are comments (remove the # to enable the line). In the default configuration, compression is enabled but not for many file types.
The same block should be:
1 2 3 4 5 6 7
Now that you corrected the config file, you can save it and restart nginx:
sudo service nginx restart
To enable text compression on Apache, you need the module deflate:
sudo a2enmode deflate
You can now restart apache to load the newly enabled module:
sudo service httpd restart
Now that compression is enabled on your server, you should see an improvement of your Qualitycs score. For example, I gained 18 points with only that configuration change:
Want to track your website’s performance over time and optimize it efficiently? Qualitycs is a SaaS tool that runs Lighthouse regularly. You can register on https://qualitycs.dev
Want to try ?
Create an account on Qualitycs and start optimizing now. In SEO, time counts !
We will never share your email address and will never spam you.