Setting up your multi-site install to handle wildcard subdomain

Events happening in the community are now at Drupal community events on www.drupal.org.
litwol's picture

I've finally had some time this weekend to play around with the server that i got from hostmysite.com. All mandatory plugging aside, given my limited needs list i am quite satisfied with the service so far, more on my experience with the representatives later.

For no better reason than just having a spare domain, i configured www.sheino.com to resolve against the server regardless of which subdomain you try it with. Really, try [ANYTHING].sheino.com and it will bring you to the same page. i find it highly interesting and i take much personal satisfaction from this simple fact because i do not come from a background that ever taught me how domains work.

My next goal is to setup an automated process to create a multi-site instance for [anything].nycdrupal.org when [anything] is requested. And then allow the user to login and administer their site. I will pre-load the site with essential modules and many other modules that I find to be safe for this experiment.

This little project is unlike http://www.opensourcecms.com/ because with my project users will be getting their own sandbox and there will be no resource sharing and database wipe. My goal is to provide an archive of the install (files + database) of the multi-site instance to the user to download. After a few days the user will comfortable with the system by playing with it on [anything].nycdrupal.org, that is when the system will archive itself and offer a downloadable file for the user to install on their own local dev or prod server.

I will provide periodical updates on the progress of the project. For now i am taking baby steps to ensure continued progress and to avoid burning out.

Of course if anyone finds this project interesting, there are many responsibilities to fill and a lot of interesting tasks to work on. I keep my hands open for any and all help you guys would be willing to offer. I think our local and the rest of the drupal community can benefit greatly from this project.

Comments

Interesting - I see

LifeNets-gdo's picture

Interesting - I see tremendous potential in this beyond just web development. This would allow an innovative organization to decentralize control to local chapters or franchises in a secure, scalable way.

did you take a look to

accessiveapps's picture

did you take a look to this?

http://drupal.org/project/domain

I had it configured to install a subdomain automatically per user and so on....

Drupal Rocks !!!

it works really well

gnat's picture

Openflows has been using the Domain Access module for a project that we are working on, and we have found it to work really well. Its a bit complex at first, but its quite well thought out, and has a really clean database structure.

Highly recommend it for people trying to have one database power several domains, with distinctions between the names.

Flag for database/ sandbox deletion

gnat's picture

While I like the idea of not having a policy where everything gets regularly destroyed, that needs to be balanced with cleaning out the cruft.

I set up sand boxes on my machine all the time, and then promptly forget about them. I end up having a ton of unused databases hanging around, and an enviable collection of half broken Drupal sites. Its not such a big deal with just me on my laptop, but multiplying it by n, we'll get a really huge amount of unused sand box space.

There needs to be a method by which sites that are being used get saved. There also needs to be a way to control the crap to good stuff ratio. I propose some form of "delete me" or "save me" flag, so that people can declare that its okay to wreck their sand castle.

very good ideas. lets crate

litwol's picture

very good ideas. lets crate a separate wiki which will be a feature + road map for phase 1, 2, ... n ? feel free to lead the way.


------------------
Sometimes interesting things appears on http://litwol.com

How did you accomplish this?

spinnach's picture

Can you tell me how did you accomplish this ? I'm currently looking into setting up a blog for each user, with an url like [username].blog.domain.com.. Could it be done in a similar fashion like you did ?

Thanks,
Dennis.

There's More than One Way to Skin a Cat

platypus media's picture

It really depends on your server configuration. For the "manual" way, you'll need to set up your DNS so that you have *.example.com pointing to your IP address for the server, vps, etc. From there, you'll need to create a vhost for your domains. That will say that *.example.com will direct to the folder where your Drupal install is located. In your sites folder, you'll need to create separate folders for each of your subdomains, where each will have their own settings.php file.

There's also http://drupal.org/project/domain this module. I haven't played with it, but it might do the trick just as well.

Mike

the important part of this

litwol's picture

the important part of this configuration is to allow your webhost to handle wildcard subdomains. to accomplish that you need to ask your domain adminstrator to configure wildcard DNS record such that *.example.com always points to your server. after that works, you need to setup your drupal site to handle arbitrary subdomains as part of single site install.


------------------
Sometimes interesting things appears on http://litwol.com

Wait, are you trying to make

platypus media's picture

Wait, are you trying to make all of the subdomains go to one db or have each of the subdomains be their own autonomous site? If they're all pointing to one shared database, then you don't need any site specific folders. They will default to the default folder if it can't find a specific subdomain folder. Otherwise, you'll need to separate them out.

Mike

I think he's talking about

litwol's picture

I think he's talking about rewrite rule such as: (*).example.com => example.com/user/$1/blog

I personally believe that all drupal installs should use domain specific installs and avoid using default folders, just personal preference.


------------------
Sometimes interesting things appears on http://litwol.com

No, i'm trying to make them

spinnach's picture

No, i'm trying to make them all point to the same db and the same Drupal installation.. Thanks everyone for the info, I'll try to set it up (I'm the DNS administrator so I think I should be able to do everything by myself)..