jaymc Posted March 3, 2010 Share Posted March 3, 2010 I am creating a CMS which will allow people to create websites using a a global website script. There content/pages etc are all stored in a mysql database, which is pulled out based on their website URL. So basically all websites have the same docRoot That works fine, however I need the ability to serve static files from the websites root directory, and of course, every website will have the same root directory! e.g www.site.com/sitemap.xml Am I right in thinking the best solution to do this is by using VirtualHost and Alias e.g Alias /sitemap.xml /masterDIR/www.site.com/sitemap.xml Is there a better way? Quote Link to comment https://forums.phpfreaks.com/topic/194040-virtual-website/ Share on other sites More sharing options...
trq Posted March 3, 2010 Share Posted March 3, 2010 If you have the access you would be much better off making each website its own virtualhost (and thus, each site will have its own document root). This will give you allot more control over each clients site. Quote Link to comment https://forums.phpfreaks.com/topic/194040-virtual-website/#findComment-1021143 Share on other sites More sharing options...
jaymc Posted March 4, 2010 Author Share Posted March 4, 2010 If you have the access you would be much better off making each website its own virtualhost (and thus, each site will have its own document root). This will give you allot more control over each clients site. I have full access yes, just didnt want to end up with a vhost file with 100s of vhosts if there was a way to do it dynamically e.g this potentually looks ok http://httpd.apache.org/docs/2.0/vhosts/mass.html What are your thoughts? Quote Link to comment https://forums.phpfreaks.com/topic/194040-virtual-website/#findComment-1021178 Share on other sites More sharing options...
trq Posted March 4, 2010 Share Posted March 4, 2010 You would want to use the dynamic approach anyway otherwise you need to restart Apache for every new client, this quickly becomes a pita. I maintain much the same setup with a server hosting 900+ sites this way. We started with all clients in one vhost, ran into problems pretty quickly (we had one rogue client getting DOS'd). moved to each client having there own vhost, then moved again to the dynamic setup when we got to around 300 clients. Quote Link to comment https://forums.phpfreaks.com/topic/194040-virtual-website/#findComment-1021201 Share on other sites More sharing options...
jaymc Posted March 4, 2010 Author Share Posted March 4, 2010 You would want to use the dynamic approach anyway otherwise you need to restart Apache for every new client, this quickly becomes a pita. I maintain much the same setup with a server hosting 900+ sites this way. We started with all clients in one vhost, ran into problems pretty quickly (we had one rogue client getting DOS'd). moved to each client having there own vhost, then moved again to the dynamic setup when we got to around 300 clients. Yeh it does sound like you have pretty much what I am trying to do. Do you have rules in the list so that root file requests such as sitemap.xml automatically forward to something like /home/$1/sitemap.xml Can you advise of any limitations you have run into using the dynamic approach? The last thing I want to do is set this all up running smooth then have to revert back due to silly issue that cant be resolved. Quote Link to comment https://forums.phpfreaks.com/topic/194040-virtual-website/#findComment-1021458 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.