Reputation: 5197
I'm trying to figure out why my custom CDN on nginx, doesn't appear to be working. Here is what I have in my site configuration:
server {
listen 80;
listen [::]:80;
server_name cdn.site.co.uk;
root /srv/www/site.co.uk/bob_user;
if ($uri !~ "\.(gif|jpe?g|png|js|css|eot|woff|ttf|svg)$") {
rewrite ^/(.*)$ https://site.co.uk/ permanent;
}
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_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
}
The file itself works - but using this tool, it tells me that it does:
This is the URL I tested:
http://cdn.businessofbrands.co.uk/wp-includes/js/jquery/jquery.js
I'm a bit confused as to why this is. Could anyone shed some light?
Upvotes: 2
Views: 1240
Reputation: 3745
It looks like application/javascript
is missing from gzip_types
.
You'll want to add it to the following line:
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;
Actually, text/javascript
is obsolete so you could just replace it :)
Upvotes: 3