Posted by tejaspmehta on January 7, 2010 at 9:59am
Hello Everyone,
I am newbie to drupal and i am assigned one task to create and manage Multisite with drupal. Now i have found few resources at
http://drupal.org/getting-started/6/install/multi-site
http://drupal.org/node/290768
but problem is we have shared hosting. We can not make any changes in Apache configuration file. Does anyone have solution for this ?
I want to make sites like following with different database and modules/themes.
www.mysite.com <- master site
www.mysite.com/site1 <- sub site's
www.mysite.com/site2
Version of Drupal is 6.x.
Any help will be appreciated.
Thank you
Tejas Mehta
Comments
Do you have shell access
If you can login to a shell then you can create symlinks pointing the folders to your main drupal install and then have different site folders for each site you wish to run. Google "shared hosting shell symlinks" for more info as I don't have the details to hand at the moment.
There are other ways to create symlinks if you cannot login to the shell (php scripts etc) but I have not tried these.
HTH,
JamieT
Hello JamieT, Thank you for
Hello JamieT,
Thank you for your comment. I do not have access of shell. I have access only of FTP and database. But i manage to create symlink with php script.
Link is http://perishablepress.com/press/2007/06/25/use-php-to-create-symbolic-l... (This might be helpfull to someone)
Now what i get is one folder but still its not working.
This are steps i have done.
-> created symlink based direcotry with this php code
symlink('other_path/multisite/sites', 'other_path/multisite/sites/subdomain.maindomain.com.multisite.site3');so i get folder with name as subdomain.maindomain.com.multisite.site3 but when i open it my browser with http://subdomain.maindomain.com/multisite/site3 it still says page not found.
I have following structure
Subdomain
Directory of Multisite Drupal
Sites
default
subdomain.maindomain.com.multisite.site3
just to confirm am i creating wrong directory name or is it okay ???
How is your server setup?
When you ftp to the server do you go straight to your web root or is your home directory one level above your webroot? When you create the symlink you create just the folder (do not worry about the domain structure). In your original example you had the following sites:
www.mysite.com <- master site
www.mysite.com/site1 <- sub site's
www.mysite.com/site2
When you ftp into the master website you would see folders for site1 and site 2 - these will be symlinks back to the main install (not the sites directory but the main drupal install. If I was in the shell and my account username was joeblogs with webroot as mysite.com then the symlink command (run within the webroot directory) would be:
ln-s site1 /home/joeblogs/mysite.comusing the script it would be:
symlink('/home/joeblogs/mysite.com', '/home/joeblogs/mysite.com/site1');Although you may want to check the order of the parameters for each of those commands as I have not tested them
hope this helps
JamieT
Hello JamiT, thanks for this
Hello JamiT,
thanks for this advise but i have few question.
when i logged in to ftp i get access to WWW.
here is my full path for my current multiple drupal site.
'/var/www/host/domain.com/subdomains/subdomain-name/httpdocs/multisite'
My question is that where i have to create new folder with symlink ? inside 'multisite/sites/' folder or at 'httpdocs/'. Also symlink are alias so will it work perfectly ? As when i created folder with symlink and try to enter into it than it show at top path is reffrence folder. is it okay ? it might look stupid question but i do not understand it so i had to ask.
as per my understanding after reading few tutorial that i have to create new folder at 'sites/subdomain.domain.com.multisite.new-folder-name'.
can you let me know where to create folder as i tried at 'httpdocs' also and inside 'multisite/sites/' but still is says page not found error. and i think i am getting this thing wrong only...
Thank you
Tejas Mehta
There are two distinct parts to this.
The first part is to get the webserver config setup to redirect requests for http://www.domain.com/site1 to redirect to the main drupal install. This is the part where we need to change vhost config (if we can meddle with webserver config) or use symlinks as in your case.
The second part is to setup the sites sub-folder for the domain so drupal can handle the multisite magic.
For the first part you seem to have nested domains which is typical of cpanel hosts. Is domain.com the master website? Can you tell me the full path to the master website (assume this is where the main drupal install is)?
Do you use cpanel or some other hosting panel? Your original example showed the structure as folders off the main domain - if you are setting up subdomains create them first in the panel (add new domain/subdomain) then find the folder that the panel created and delete this folder and create a symlink to the root of the main drupal install in its place. The with the sites folder of the main drupal install create a new folder as per the instructions in default.settings.php.
I am at work at the moment so it is hard to go into any real detail but hopefully above comments can help.
JamieT
Thanks for your time to make
Thanks for your time to make comment so quickly.
My master drupal site is at folder at sub-domain. From browser i can access it like
http://subdomain.domain.com/multisite/
path to that is '/var/www/host/domain.com/subdomains/sub-domain/httpdocs/multisite/'
i want my sub-sites like this way
http://subdomain.domain.com/multisite/site1/
http://subdomain.domain.com/multisite/site2/
Also my client have some hosting panel but yet not provided details and provided me only FTP and DB details only. so i can not tell that its cPanel or Plesk. But sub-domain he created works perfectly. As he saw his client lots of static site for demo like this way.
http://subdomain.domain.com/site1_static/
http://subdomain.domain.com/site2_static/
So i think sub-domain is created properly. Also i can not delete this folder because lot of working sites are inside it.
I appreciate your help and understand your working hours so when you get time please try to help me out in this topic. I have to display this on Saturday.
I hope my question is clear. i want to make multisite in one directory which is directory in sub-domain.
Try this
Create symlinks using your phpo script as follows (again check order of parameters as I have not tested this):
symlink('/var/www/host/domain.com/subdomains/sub-domain/httpdocs/multisite', '/var/www/host/domain.com/subdomains/sub-domain/httpdocs/multisite/site1');symlink('/var/www/host/domain.com/subdomains/sub-domain/httpdocs/multisite', '/var/www/host/domain.com/subdomains/sub-domain/httpdocs/multisite/site2');
Then within the sites folder of your main drupal install at /var/www/host/domain.com/subdomains/sub-domain/httpdocs/multisite/ create subdirectories for each domain as follows:
sites/subdomain.domain.com.multisite.site1
sites/subdomain.domain.com.multisite.site2
The above is from the instructions at default.settings.php.
HTH,
JamieT
Finally its working now
Hello JamieT,
Thank you for your support. Its working now. Can you answer my last question ? Why did you make symlink first ? I am still confused on it. As without using symlink it is not working.
Once again Thank you for your help.
Thank you
Tejas Mehta
Symlink required by webserver.
The symlink is a filesystem redirect to assist the webserver to get to the drupal codebase.
When you navigate to http://subdomain.domain.com/multisite/site1/ the server is looking for filesystem path: /var/www/host/domain.com/subdomains/sub-domain/httpdocs/multisite/site1 the filesystem redirects this path using the symlink to the drupal install at /var/www/host/domain.com/subdomains/sub-domain/httpdocs/multisite/ as far as the webserver is concerned it is looking at files located at /var/www/host/domain.com/subdomains/sub-domain/httpdocs/multisite/site1 and it has no knowledge of this redirect.
Once you are using the drupal codebase drupal then determines which hostname is being requested and uses the settings.php et al from the relevant sites folder.
Hope this clarifies the order of process etc.
JamieT
Thank you for this
Thank you for this clarification. I understand now.
Thank you
Tejas Mehta
regarding preinstalled themes and modules
I think instead of starting new thread i should continue my next question here.
I have successfully installed and set multisites on my sub-domain as you can see in above comments. Now what next thing i am planning is when i create new folders at 'sites/' i will also add some necessary module for particular websites as following
sites/folder_name/setting.php
sites/folder_name/modules/list_of_modules
sites/folder_name/themes/list_of_themes
Also i am coping same database with modules table and another items and setting values in setting.php file.
but when i open site at http://subdomain.domain.com/multisite/site1/ than page appears blank and when i go to install.php it says site already installed and view your existing site. But by clicking on that link page again appears blank. Can anyone help me out ?
In short i have one site ready and i am coping that database with new name and uploading same modules and theme on my new multisite setup but its not working.
Thank you
Tejas Mehta
Shouldn't you be opening the
Shouldn't you be opening the url: http://subdomain.domain.com rather than http://subdomain.domain.com/multisite/site1/ ? Try that.
Also make sure that your new site points to your drupal install.
i have perfectly set my url
i have perfectly set my url in setting.php file and also from browser if i open http://subdomain.domain.com/multisite/site1/ than it shows me perfect nodes of site1.
but no effect of themes has been shown.
when i view source code of page than it looks like follow.
<link rel="shortcut icon" href="/multisite/site1/sites/default/files/wabi_favicon.ico" type="image/x-icon" /><link type="text/css" rel="stylesheet" media="all" href="/multisite/site1/modules/node/node.css?u" />
<link type="text/css" rel="stylesheet" media="all" href="/multisite/site1/modules/system/defaults.css?u" />
<link type="text/css" rel="stylesheet" media="all" href="/multisite/site1/modules/system/system.css?u" />
my current structure is like this way
document_rootdocument_root/sites/
document_root/sites/subdomain.domain.com.multisite.site1/
document_root/sites/subdomain.domain.com.multisite.site1/setting.php
document_root/sites/subdomain.domain.com.multisite.site1/themes/
document_root/sites/subdomain.domain.com.multisite.site1/modules/
document_root/sites/subdomain.domain.com.multisite.site1/files/
but i think problem is drupal is not getting my current configuration based on this multisite concept. does anyone know how to set it properly ???