I have two ecommerce websites, selling music digital downloads, on the same VPS, currently using cPanel/WHM (but thinking of switching to Virtualmin). They have separate domains and IPs of course. They both share from the same set of music files, so I have duplicate copies in each website directory, which takes up a lot of disk space. How might I go about sharing the same set of music files across both sites, allowing PHP access, so that it does not break my shopping cart's functionality of serving customers the downloads after they have paid for them? I thought of maybe using symlinks or something, but I don't know if it's possible, or if it would have to somehow circumvent built-in security features of the server. I'm new to VPS management.
1 Answer
I'd build a sub-domain for each site music.domain.com and point each to a single directory containing all the music. You'd have more control that way, without appearing to go to another site for the music.
This does mean that you'd have to have two SSL certs, so it may be cheaper to buy a new domain and do it that way.
-
I'm not sure how I could make a subdomain solution work... The music files are are served to the customers by PHP scripts that read the files and send headers to tell the browser to download them... So, I believe I need some way for the php scripts in each of the sites to access the same files, like via symbolic links appearing as directories in their own directory trees. Is that possible? May 22, 2012 at 16:10
-
@LeeFentress it's definitely possible, but you'd really need to ask the php gurus over at StackOverFlow or the Apache gurus at ServerFault for the how. But you could certainly setup sym links on the server to mirror the directory structure from one site to the other. May 22, 2012 at 17:57
-
why not let first site refer to music files in the other site with sufficient authorization?– AgAOct 25, 2012 at 8:07
-
I don't see how subdomains come into play here. You're not going to want to put any digital download products inside of the webroot of an Apache vhost. This is purely an issue of filesystem security/permissions. If he's running both sites off of a single user, then it's a simple matter of pointing both shopping carts to the same directory (if possible) or symlinking them. If he's running the sites under different chrooted users and the shopping cart requires a certain directory structure, it might be more complicated. I'd just use a single Magento install to manage both stores. Feb 22, 2013 at 13:40