Jump to content

Virtual Website


jaymc

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/194040-virtual-website/
Share on other sites

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?

Link to comment
https://forums.phpfreaks.com/topic/194040-virtual-website/#findComment-1021178
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/194040-virtual-website/#findComment-1021201
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/194040-virtual-website/#findComment-1021458
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.