You can achieve this by creating a subdomain on your server configuration and linking the root folder of the new subdomain to the js/css folders you want to server from there with something like
ln -s /var/www/html/domain.com/magento/media /var/www/html/domain.com/cdn/media
for skin and js folders.
This guide shows you how to achieve this on nginx, it should be pretty straightforward with apache too.
You can add some expire headers for the resources in the vhost creation or in a .htacess too.
Then go to System > Configuration > Web > Unsecure and change {{unsecure_base_url}} to the new subdomain you created for all the resources you want to server from your local CDN. Same for Secure urls.