Drupal multisite in a Linux / Parallels / Plesk 8 setup

You have Plesk 8 running on your Apache server and would like to create multiple websites using one Drupal codebase.

Let me tell you...this was a bitch. But don't panic...it's do-able.

There are multiple ways of achieving it...and I think I tried them all. Most of the tutorials I found on the web were vague to say the least, and misleading...especially to those who haven't got brains the size of houses. I invested loads of time to get this up and running....which made it even more annoying when the answer turned out to be quite simple. I'll tell you what worked for my server...then I'll cover what didn't.

So...let's start.

Needless to say...you will need full server admin rights to set this up.

You have one Drupal website up and running...lets say  example10.com. Everythings running fine...but you now need to create the website example20.com.

You have the new domain...now log in to Parallels control panel and register the domain under your subscription.

'Domain Management' > 'All My Domains'. Click 'Edit' and choose your subscription. If you have multiple subscriptions....choose the one which serves the example10.com domain.

Still in the Parallels control panel...under 'Server Management' click 'File Manager' > 'var' > 'www' > 'vhosts' > 'example10.com' > 'conf'.

Now you may or may not see a file in the 'conf' directory called 'vhost.conf'.

You will see a file called 'httpd.include'. You may be able to achieve a multisite setup by editing the 'httpd.include', but this file gets updated automatically by Plesk and may overwrite any changes you make....so..bad news for us..we won't touch it.

If 'vhost.conf' doesn't exist...create it (make a text document in something like notepad and upload it). Make sure it's called 'vhost.conf' and not 'vhost.conf.txt' or 'vhosts.conf'. The latter won't work...I know!!

In this 'vhost.conf' file write the following line

ServerAlias *.example20.com

(replacing example20 with your new domain name :) Now you need to restart Apache to load the changes. Do this under 'Server Management' > 'Restart'.

Alternativly..if you are able to run a command line, run this line

/usr/local/psa/admin/sbin/websrvmng --reconfigure-vhost --vhost-name=example10.com

(replacing example10 with the domain of your original drupal install)

Don't know what 'command line' means? You'll need a SSH Client to run server shell commands. I use PuTTY. Log in with PuTTY. (you will not see your password when typing it into PuTTY...thats normal. Just type it and press enter). Type the command line above...press enter...finished!

 

So...that's it for the server config.

Now..when you call example20.com in a Browser it should be directed to example10.com.

That's great...but we want a new website don't we?

Not the same one as example10.com. Drupal does the rest.

Log in to your Drupal domain with an FTP Client of your choice. I use FileZilla.

In the main Drupal directory (where you installed Drupal. Mine is httpdocs) you will find a directory called 'sites'. The sites dir is your baby.

Open it and you will see two directories....'all' and 'default'. If you installed Drupal then you will know these directories.

Especially if you are running a custom theme because you will have uploaded it in the 'all' directory under 'themes' However...to let Drupal know where to point example20.com to....you have to create a new directory under 'sites'. Name it example20.com. (submitting example20 with your new domain name).

You don't need to use the www prefix...even if your site uses it.

You can now go ahead with the normal Drupal install of the new site in the example20.com dir.

An easy way is to copy the contents of the 'default' directory (files directory, default.settings.php and settings.php) and correcting the database details of the settings.php with your new database for example20.com (yes...every new Drupal multisite needs its own database)

CHMOD the settings.php and files directory and navigate in your browser to example20.com/install.php.

(You may need to change the file permissions back after install has run).

You should now have your Drupal multiste running.

Now onto what didn't work.

I found loads of promising tutorials out there which I just couldn't implement.

After setting up both domains in Plesk to physical hosting. Create a symbolic link from one domain to the other.

Delete the httpdocs dir from /var/www/vhosts/example20.com and create this SymLink using command line.

ln -s /var/www/vhosts/example10.com/httpdocs /var/www/vhosts/example20.com

Looking in the Parallels File Manager you should now see the directory httpdocs in the domain example20.com. This directory is actually in the domain example10.com and you should be able to navigate through it.

Fine...but it didn't work. Every time I called example20.com in a browser i just got 403 forbidden answers.

I played for a while with vhost.conf lines like Option +FollowSymLinks and php_admin_value open_basedir but nothing worked. Everytime 403...so I ditched it.

Another way is to edit the httpd.conf file...which is the main Apache configuration file.

Adding something like this to the VirtualHosts part of the file.

DocumentRoot /var/www/vhosts/example10.com/httpdocs
ServerName example20.com
ServerAlias www.example20.com

This just did absolutly nothing. If any one knows why...I would still like to know...even though I have my Multisite running.

 

I hope this saved someone the stress I suffered :)

Filed under: 

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Type the characters you see in this picture. (verify using audio)
Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.