-
Notifications
You must be signed in to change notification settings - Fork 87
/
fast-nginx.conf
27 lines (23 loc) · 936 Bytes
/
fast-nginx.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# 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;
}
}