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
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.

Link to comment
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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.