nginx wordpress js with gzip?
nginx wordpress js with gzip?
Hi,
Can someone explain to my why if I use gzipwtf.com gtmetrix.com or the google web one, that it comes back saying that JS files are not gziped on my website?
however if I run a curl command
it says it is working for JS?
Can someone explain to my why if I use gzipwtf.com gtmetrix.com or the google web one, that it comes back saying that JS files are not gziped on my website?
however if I run a curl command
Code: Select all
curl -H "Accept-Encoding: gzip" -I http://wordpress.highlands.ac.uk/wp-includes/js/wp-embed.min.js
HTTP/1.1 200 OK
Server: nginx
Date: Tue, 07 Jun 2016 15:36:12 GMT
Content-Type: application/javascript
Last-Modified: Tue, 07 Jun 2016 09:43:36 GMT
Connection: keep-alive
Keep-Alive: timeout=60
Vary: Accept-Encoding
ETag: W/"57569748-57b"
Expires: Thu, 31 Dec 2037 23:55:55 GMT
Cache-Control: max-age=315360000
Content-Encoding: gzip
Re: nginx wordpress js with gzip?
What's your configuration like because none of your .JS files are gzipped (or so it says).hcjsy wrote:Hi,
Can someone explain to my why if I use gzipwtf.com gtmetrix.com or the google web one, that it comes back saying that JS files are not gziped on my website?
however if I run a curl command
it says it is working for JS?Code: Select all
curl -H "Accept-Encoding: gzip" -I http://wordpress.highlands.ac.uk/wp-includes/js/wp-embed.min.js HTTP/1.1 200 OK Server: nginx Date: Tue, 07 Jun 2016 15:36:12 GMT Content-Type: application/javascript Last-Modified: Tue, 07 Jun 2016 09:43:36 GMT Connection: keep-alive Keep-Alive: timeout=60 Vary: Accept-Encoding ETag: W/"57569748-57b" Expires: Thu, 31 Dec 2037 23:55:55 GMT Cache-Control: max-age=315360000 Content-Encoding: gzip
Re: nginx wordpress js with gzip?
gzip bit from : /etc/nginx/nginx.conf
Code: Select all
# Compression
gzip on;
gzip_comp_level 9;
gzip_min_length 512;
gzip_buffers 8 64k;
gzip_types gzip_types text/plain text/css application/json application/javascript text/xml application/xml
application/xml+rss text/javascript application/vnd.ms-fontobject application/x-font-ttf
font/opentype image/svg+xml image/x-icon;
gzip_vary on;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
gzip_proxied any;
Re: nginx wordpress js with gzip?
Was it a copy / paste job?
Please see bolded error:
gzip_types gzip_types text/plain text/css application/json application/javascript text/xml application/xml
application/xml+rss text/javascript application/vnd.ms-fontobject application/x-font-ttf
font/opentype image/svg+xml image/x-icon;
You may also want to add in application/x-javascript
Please see bolded error:
gzip_types gzip_types text/plain text/css application/json application/javascript text/xml application/xml
application/xml+rss text/javascript application/vnd.ms-fontobject application/x-font-ttf
font/opentype image/svg+xml image/x-icon;
You may also want to add in application/x-javascript
Re: nginx wordpress js with gzip?
apologies the config doesnt have the duplicate gzip_types, I will add application/x-javascript , but that isn't in the mime types file so not sure it will do anything?
Last edited by hcjsy on Wed Jun 08, 2016 12:04 pm, edited 2 times in total.
Re: nginx wordpress js with gzip?
Also the website is using web template hosting and proxy template hosting
Re: nginx wordpress js with gzip?
application/javascript is the "standard" and both others are obsolete but if you can add both to the mime types and test again it may help.
Also take a look in /home/<USER>/conf/web for nginx.conf files as a setting may be overriding it (no need to unless you have changed something in there) as the default proxy template is OK.
Also take a look in /home/<USER>/conf/web for nginx.conf files as a setting may be overriding it (no need to unless you have changed something in there) as the default proxy template is OK.
Re: nginx wordpress js with gzip?
I've just ran the test again and still coming back with saying gzip not for js :(
Re: nginx wordpress js with gzip?
If you add it directly in server { }
/home/<USER>/conf/web/nginx.conf like so:
Does that work!?
/home/<USER>/conf/web/nginx.conf like so:
Code: Select all
server {
listen blah;
server_name blah;
root /home/blah/web/blah/public_html
gzip on;
gzip_disable "msie6";
gzip_comp_level 6;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_proxied any;
gzip_types text/js text/javascript application/javascript application/x-javascript;
}
Re: nginx wordpress js with gzip?
Thanks for the suggestions.
nginx: [warn] duplicate extension "js", content type: "application/x-javascript", previous content type: "application/javascript" in /etc/nginx/mime.types:9
but still the same :(
nginx: [warn] duplicate extension "js", content type: "application/x-javascript", previous content type: "application/javascript" in /etc/nginx/mime.types:9SS88 wrote:application/javascript is the "standard" and both others are obsolete but if you can add both to the mime types and test again it may help.
nginx: [warn] duplicate extension "js", content type: "application/x-javascript", previous content type: "application/javascript" in /etc/nginx/mime.types:9
but still the same :(
have checked these, but no reference to gzip in them.SS88 wrote:Also take a look in /home/<USER>/conf/web for nginx.conf files as a setting may be overriding it (no need to unless you have changed something in there) as the default proxy template is OK.