By Anand Arun
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!
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.
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
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.