Report this

What is the reason for this report?

Enabling Gzip compression guidance needed

Posted on September 4, 2019

Hi, Guys

I am following this tutorial https://www.digitalocean.com/community/tutorials/how-to-add-the-gzip-module-to-nginx-on-ubuntu-16-04, but when testing, the output is different. It seems something is not working for me.

After following the steps in the tutorial, when testing:

curl -H "Accept-Encoding: gzip" -I http://localhost/test.jpg

The output is:

HTTP/1.1 301 Moved Permanently
Server: nginx/1.10.3 (Ubuntu)
Date: Wed, 04 Sep 2019 18:33:30 GMT
Content-Type: text/html
Content-Length: 194
Connection: keep-alive
Location: https://radha.org.br/test.jpg

So the header Content-Encoding: gzip is not appearing.

Another question is that i have two wordpress websites in my droplet. This configuration will impact the two of them or i have to configure each site separatedly for Gzip compression to work?

Anyway, i followed the tutorial until its end and after that i gave a reboot in my droplet, but still it seems hothing has changed.

Thank you so much for taking care.



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

@KFerdinandov

Cambio… thanks

Hi @Areku,

Can you provide us with the relevant Nginx configuration? Did you add the gzip compression to your conf?

Additionally, what’s the exact command you are using to check your files. Is it

curl -H "Accept-Encoding: gzip" -I http://localhost/test.js

Kind regards, Kalin D.

@KFerdinandov

It is a beautiful morning here. I wish these vibrations reach you wherever you may be :)

Yes, i gave:

sudo nano /etc/nginx/nginx.conf

Made the changes and it looks like this:

        # Gzip Settings
        ##

        gzip on;
        gzip_disable "msie6";

        gzip_vary on;
        gzip_proxied any;
        gzip_comp_level 6;
        gzip_buffers 16 8k;
        gzip_http_version 1.1;
        gzip_min_length 256;
        gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/vnd.ms-fontob$fontobject application/x-font-ttf font/opentype image/svg+xml image/x-icon;

Then i gave:

curl -H "Accept-Encoding: gzip" -I http://localhost/test.jpg

And i got:

HTTP/1.1 301 Moved Permanently
Server: nginx/1.10.3 (Ubuntu)
Date: Wed, 04 Sep 2019 18:12:38 GMT
Content-Type: text/html
Content-Length: 194
Connection: keep-alive
Location: https://radha.org.br/test.jpg

I tried this one too:

curl -H "Accept-Encoding: gzip" -I http://arun.com.br/test.jpg

And with the latest command i got:

HTTP/1.1 301 Moved Permanently
Server: nginx/1.10.3 (Ubuntu)
Date: Wed, 04 Sep 2019 18:16:23 GMT
Content-Type: text/html
Content-Length: 194
Connection: keep-alive
Location: https://arun.com.br/test.jpg

Thank you so much.

OMMMMMMM

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.