Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: master
28 lines (23 sloc) 0.936 kb
# sample server section for your poor man's CDN
# * <your.ip.address> - your IP address
# * http://www.example.net/ - CDN hostname (not a subdomain of main site!) or IP (to also save time on DNS lookups)
# * http://www.example.com/ - URL of main site so we can redirect there from root
# * /path/to/document/root/ - path to the folder where assets live
server {
listen <your.ip.address>:80;
server_name http://www.example.net/;
location / {
rewrite ^ http://www.example.com/ permanent;
}
location ~* ^.+\.(png|jpg|jpeg|gif|css|js|ico)$ {
root /path/to/document/root/;
expires 1y;
# main rewrite rule to ignore the number in http://www.example.net/asset.123.jpg
rewrite ^(.*)\.(\d+)(_m_\d+)?\.([^\.]+)$ $1.$4 last;
gzip on;
gzip_min_length 1000;
gzip_proxied any;
gzip_comp_level 2;
gzip_types text/plain application/xml text/css application/x-javascript text/xml;
}
}
Jump to Line
Something went wrong with that request. Please try again.