While reading up on some Magento I was again attracked to the following: How can I set-up a Magento CDN on local server by subdomain? [also see attached images]
I am envisioning to set-up cdn.mymagentoserver.com, have it point to the same public_html folder as www.mymagentoserver.com and change the media directories as shown below.
Question:
- how does one set-up a subdomain like described?
Additional to think about
- would it also work for all domains of a multistore?
- how about when I add https in the future? Wouldn't the images be coming from an unsafe domain if I had a SAN certificate? or would I just add the subdomain too
- Is this all worth it?
Best Answer
It's possible, but by definition not a CDN (content delivery network)
There are still advantages though: if you set up the cookie domain in Magento to
www.example.com
, cookies will not be sent with requests tostatic.example.com
, making the requests a bit more lightweight and faster (also: more cachable). The cookie domain can be set up in the same config section as the base urls. If your base URL is likeexample.com
without "www", useexample.com
and pay attention that it's not prepended by a dot (because.example.com
would include all subdomains)Another argument is that browsers limit the number of parallel requests per domain, so having a second domain can speed up total page load as well. But this is not so relevant today anymore, so take it with a grain of salt and especially don't start to distribute the requests over more than two or three domains.
Source: http://www.stevesouders.com/blog/2013/09/05/domain-sharding-revisited/
As for your question how to set it up: ask your hoster. They can either do it for you or tell you how to do it. It's not exactly the same on every system.