How to set up a private CDN using nginx?

Install Nginx on the 2nd server and set it up as a lightweight static proxy cache file server:

server {
 
        open_file_cache_valid 200 20m;
        listen 80;
        server_name yourcdndomain.com;
        access_log   /srv/www/yourcdndomain.com/logs/access.log;
        root   /srv/www/yourcdndomain.com/public_html/;
 
 
 
      location ~* \.(jpg|png|gif|jpeg|css|js|mp3|wav|swf|mov|doc|pdf|xls|ppt|docx|pptx|xlsx)$ {
                                # Cache static-looking files for 120 minutes, setting a 10 day expiry time in the HTTP header,
                                # whether logged in or not (may be too heavy-handed).
 
                                open_file_cache_valid 200 120m;
                        expires 7776000;
                        open_file_cache staticfilecache;
                }
 
location = /50x.html {
                root   /var/www/nginx-default;
        }
 
 # No access to .htaccess files.
        location ~ /\.ht {
          deny  all;
        }
 
    }

Rewrite your static files to the new domain or change the urls

Edit

I changed the file above to use open_file_cache instead of proxy_cache