Permalink
Browse files

Moved sample nginx config here too.

  • Loading branch information...
1 parent bb726da commit 779ea5403b959d77b1eadf122d3bf6ed8926a5ec @sergeychernyshev committed Sep 1, 2010
Showing with 27 additions and 0 deletions.
  1. +27 −0 fast-nginx.conf
View
@@ -0,0 +1,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;
+ }
+}

0 comments on commit 779ea54

Please sign in to comment.