Quantcast
Viewing all articles
Browse latest Browse all 2052

How to set up Drupal Multi Site for Multi domainnames (+websites) together with an already installed WordPress MultiSites in Bitnami Cloud Hosting

How to set up a Drupal Multi Site configuration in Bitnami Cloud Hosting (1 Server Instance) ? On our Bitnami Cloud Server Instance we previously installed the Bitnami WordPress Multisite Module as well as Bitnami Modules Drupal, Joomla and Moodle and PhpMyAdmin. Additionally we installed Webmin (www.webmin.com) ( a server control panel like CPanel/Plesk). We see two Apache Virtual Hosts (one for WordPress Multisites) on our server and like to use Webmin to create Vhosts for future websites and domainnames instead of hard to use Ubuntu server commands.

**Note: Good news. Both applications (WordPress - Drupal) work properly now and we completed the Drupal installation of www.abcd.com ! WordPress servers 2 domainname sites and Drupal with www.abcd.com (and a second domainname to come soon) domainname site. Only the VirtualHost file contents for the domainnames need to be checked by Bitnami Support and then some re-editing below !

Note: refer to a separate Wiki Bitnami posting for important information dealing with how to change the domain name ( and machine_host name) for WordPress Multisite: http://answers.bitnami.org/questions/5018/i-have-wordpress-multisite-installed-how-can-i-change-the-domain-name

We named our Bitnami Server: http://abcd.bitnamiapp.com and connected to a static IP. The prefix 'abcd' in your case is your chosen server name or the servername issued by Bitnami Cloud Hosting ! Our domainname's www.abcd.com and www.spqr.com for our Drupal sites were pointed to our server's abcd.bitnamiapp.com static IP but not 'attached' to any of our installed Bitnami Modules (Apps) or the Bitnami Drupal Module!

Similarly two other domainnames ( as: www.jkk.com and www.hijk.com ) pointed to our server but these set up in the Bitnami WordPress Multisite Module and now serve up their custom domainname WordPress websites.

How now to set up our installed Bitnami Drupal Module to serve up these custom domainname Drupal websites for www.abcd.com and www.spgr.com pointing to our Server IP ?

This is a so called Drupal MultiSites set up with Virtual Hosts (a separate VirtualHost for each domain name) with (one) separate Database(s) per domainname/website. Each Drupal (domainname)website however uses the code base of the main installed Bitnami Drupal Module with and its Drupal modules and themes (which can then be selected/switched on/off for the repective domainname website e.g. abcd.com)

For this we need to understand and learn to create the needed Virtual Hosts and various .conf (configuration) files, update existing databases, change server names, move Bitanami Apps/Modules to serve from root etc.

For the future we would like: a server set up whereby the main URL's e.g. in our case 'www.abcd.com' and 'http://abcd.com' serve up the Drupal site, and 'httpd://blog.abcd.com" serves up the WordPress website(functionality) for that domainname (e.g. news blog version) and possibly (?) 'http://training.abcd.com' serves up the Moodle website(functionality) for that domainname.

Before starting off typing: 'www.abc.com' in our browser serves up a WordPress set up page and typing 'www.abc.com/drupal' serves up the Drupal Bitnami set up page. The reason for this is that the BitNami WordPress Multisite module is always configured by default to be served in (root) / (not like other modules). We first need to resolve this 'problem' by following the below instructions:

First: Configure the WordPress to a specific Domain Name

The easiest first. Configure your wordpress.conf file (in apps/wordpress/conf/wordpress.con) to be served in jkk.com. For that you just need to the ServerName. Also execute from the server command line: $ sudo /opt/bitnami/apps/wordpress/updateip --machine_hostname jkk.com

Before restarting your machine, it is important to rename the updateip tool to updateip.disabled so the domain name is not automatically changed when booting the server.

$ sudo mv /opt/bitnami/apps/wordpress/updateip /opt/bitnami/apps/wordpress/updateip.disabled

After this if you point your browser to abcd.bitnamiapp.com you will see the main BitNami page and in 'Access my application' you will see the list of applications installed (notice that the link to wordpress will not work because we have changed its configuration, you can manually change the link in the /opt/bitnami/apache2/htdocs/applications.html file).

More details and important information about this step can be found via this weblink here.

There you can also find important information on how the various conf files should look like ...!

Secondly: Now Configure Drupal to be served in /

Once Wordpress has been moved to be served in a different server name we can move Drupal to root without conflicts.

To move Drupal to root we turned to the instructions in the Wiki Bitnami: http://wiki.bitnami.org/Applications/BitNami_Drupal#How_to_change_the_default_URL_to_root.3f

To make life easy we selected the "automatic approach" and used the 'updateip' tool included in Bitnami Cloud Hosting by executing the following command on the server:

$ sudo /opt/bitnami/apps/drupal/updateip --appurl /

Next we restarted the server through our AWS or Bitnami Console.

To make double sure we also restarted Apache server: $ sudo /opt/bitnami/ctlscript.sh restart apache

From the server messages: "Syntax OK .... httpd stopped ... Syntax OK ..... httpd started at port 80 " we see all is OK !!

Third step: Configure Drupal as Virtual Host

Once you have moved Drupal to / configure it as Virtual Host is as simple as editing the /opt/bitnami/apps/drupal/conf/drupal.conf file and including the <virtualhost> directive which will enclose everything else in the file. Modify your drupal.conf file so its looks like the below:

---- we used the drupal.conf file settings as given in Kaysa's answers below !!! ----

We filled in: ServerAdmin our gmail address and for Servername abcd.com

Before setting up our Drupal website for abcd.com we made a mysql database and username (using phpmyadmin) for abcd.com using this servername abcd.com.

**The answer to our question for Kaysa on whether we should (not?) create a special separate virtualhost file in /opt/bitnami/apps/virtualhost.conf for all our Apps as explained in: http://wiki.bitnami.org/Components/Apache#How_to_create_a_Virtual_Host.3f ?

is that it is a matter of choice as long as the Apache server can find/read these instructions**

Fourth step: Configuring Drupal Multisite

Now follow the Drupal documentation for configuring Drupal Multisite. Creating the new database, the new directory under sites, copy the settings.php file, creating the symbolic link if needed... Notice that when you create the folder for the new site you need it needs to belong to bitnami.daemon (if not you will see an permissions related errors when following the drupal web wizard). Also when pointing the wizard to the new database make sure (!!) to specify under the advanced option (!!) the mysql socket for BitNami being: /opt/bitnami/mysql/tmp/mysql.sock.

The Outcome of Steps 1 to 4 !!!!

Typing www.abcd.com or http://abcd.com serves up http://www.abcd.com/install.php a new Drupal Installation Page which demonstrates Drupal Multisite is working !!

Initially we experienced that our other domainnames for Wordpress Website(s) were serving up - unwanted - Bitnami Drupal website(s) instead of the WordPress website(s). We resolved this by following instructions and adjusting conf. file contents at http://answers.bitnami.org/questions/5018/i-have-wordpress-multisite-installed-how-can-i-change-the-domain-name

Needless to say typing: abcd.bitnamiapp.com (our ServerName!) also serves up the Bitnami Drupal Page now !


Other General and Useful information before continuing:

  • Only one IP address per server instance: Amazon AWS EC2 / Bitnami Cloud Hosting at this time is only available with ONE IP address PER SERVER INSTANCE. More IP's might become available per Server Instance in the near future (hopefully!). Reason for this remark is that we initially wanted the Drupal Multi Site set up to work with Multiple IP's attached to our Bitnami Server Instance.
  • Drupal Multisite Configuration - Sharing the same code base: we want to 'use' the current Bitnami Drupal Installation (code base) and its Modules and Themes for other domainname(s) so we have many Drupal website(s). Once mastered we can easily create, set up and manage new Drupal websites in Bitnami Cloud Hosting.
  • BitNami modules structure and default url: all our Bitnami Applications are located at: /opt/bitnami/apps/ ('wordpress'/)or ("drupal'/) or ('moodle'/) or ('joomla'/) etc.
  • How to assign a custom domain to your BitNami Server configuring apache. More information about apache virtual host here.

Other references on Drupal MultiSite (some of them not applicable for BitNami Drupal !):

An extensive explanation on a Local multi-site installation of Drupal 7 on Linux at Drupal.org: http://drupal.org/node/1114158

A good source of information for configuring Drupal 7 Multisites in Linux: http://drupal.org/node/823990

Multisite - Sharing the same code base: on Drupal.org http://drupal.org/node/251040

Understanding: the differences between the BitNami installation and Ubuntu:

Various articles confuse us by referring to /etc/apache2/apache2.conf as these guides are specific for Ubuntu. Note that the main Apache configuration file in BitNami is httpd.conf (in our Bitnami Cloud Server located at /opt/bitnami/apache2/conf/httpd.conf) .

Similarly folders: /etc/apache2/sites-available/ and /etc/apache2/sites-enabled/ are also specific to Ubuntu and other linux distributions and should not be found or created in your BitNami set up.

Should you find the following file - as we did - /opt/bitnami/apache2/conf/sites-available then again this file doesn't belong to a Bitnami installation !!! When using Webmin to create a VirtualHost for a domainname make sure not to point to this sites-available file as Webmin pre-selects this for you but to pint to your application conf file (e.d. drupal.conf) in: /opt/bitnami/apps/drupal/conf/drupal.conf

The very important Drupal 7 Sites folder can be found in /opt/bitnami/apps/drupal/htdocs/sites with its two sub folders: /all/ and /default/

How to continue setting up Drupal Multisite?!

This is the Wiki Page for Multisites Using Drupal 7. Acording to it the Skeleton of a Drupal 7 multisite guide can be as follows :

  1. Install Drupal 7 the normal way on the first domain. (My comment: Bitnami has done that for us!)

  2. Make your DNS work for the second site's domain (2ndsite.com) to point to same IP. (My comment: No problem we know how to point our Domainname to our Bitnami Server!)

  3. Make your Web server work for the second site's domain to point to same directory. (for apache this can be adding the second domain as an alias in the current host or making a new virtual host that has the same document root). (My comment: Good idea to make a new virtual host, how do we do that and where ?).

  4. Make a new directory with name equal to the second site's domain in under the sites directory (drupal7/sites/2ndsite.com) (My comment: That is possible in our /opt/bitnami/apps/drupal/htdocs/sites folder ! What about the other sub folders /all/ and /default/ of the drupal/htdocs/sites/ folder

Then either :

5.a. chmod the second site's directory (drupal7/sites/2ndsite.com) to 777 (change permissions so that they can be modified by anyone)

OR

5.b. Make a new directory called files (drupal7/sites/2ndsite.com/files) and chmod this new directory to 777.

  1. Copy default.settings.php to the new site's directory as settings.php (drupal7/sites/2ndsite.com/settings.php) and then chmod it to 666

  2. Navigate to the second domain (2ndsite.com) and install Drupal normally.

It can be easily noticed that steps from 5 to 7 are normally done when installing Drupal (like in first step).

Alternatively steps 7 and further in my situation (@summit): +++++++ .7. Copy example.sites.php to sites.php (keep it withing drupal7/sites) then chmod it to 666

  1. Add the bottom op sites.php set up the mapping using the sites array:view source $sites['secondsite.com'] = 'secondsite.com';

  2. Then chmod sites.php it to 666

10.Navigate to the second domain (2ndsite.com) and you will see the first site.

11.Add domain access module and other domain modules: www.drupal.org/project/domain for best multisite handling.

  1. All of the sites will want to use the .htaccess file in the main D7 directory. For this reason, the RewriteBase directives in this .htaccess must be commented out:

    RewriteBase /drupal RewriteBase /

Otherwise clean urls will not work.

-------------------------------------------------------------------------------------------------

Our accomplishments so far using the above information:

  1. we created for our domainname abcd.com a sub folder named: /abcd.com/ in: /opt/bitnami/apps/drupal/htdocs/sites/abcd.com/
  2. we 'chmod' the file/folder permissions of this /abcd.com/ folder to 777
  3. we need to change the file/folder permissions to bitnami.daemon for this /abcd.com/ and use the following server command: $ sudo chown -R bitnami /opt/bitnami/apps/drupal/htdocs/sites/abcd.com/
  4. we copied the default.settings.php (in /opt/bitnami/apps/drupal/htdocs/sites/default/ to the new /abcd.com/ as settings.php ( .../abcd.com/settings.php) and then chmod it to 666
  5. we created a new (empty) database with a new user (username and password) with the right permissions (by comparing and "copying' the permissions etc of the standard issue Bitnami Drupal Database and user) using phpMyAdmin

  6. we used Webmin to create a Virtual Host for abcd.com:

The virtual server details of abcd.com in Webmin are:

Address: any
Port: 80
Document Root: /opt/bitnami/apps/drupal/htdocs/sites/abcd.com/htdocs
Server Name: abcd.com

Preliminary remarks:

All installed Bitnami Modules on our Server can be accessed by typing either http://abcd.bitnamiapp.com/applicationname or http://12.34.567.89/applicationname (Drupal, Joomla, Moodle etc). This serves up a (functioning) log-in page of the respective Bitnami application (e.g. Bitnami Drupal!).

Will our name choice 'abcd.bitnamiapp.com' for our server create any problems now we want to set up domainname www.abcd.com or //abcd.com for a Drupal website. The answer is this creates NO PROBLEMS !!

Virtual Host - conf Files

As mentioned before we used Webmin to create a Virtual Host for our domain abcd.com. We also studied the Wiki Bitnami: http://wiki.bitnami.org/Components/Apache#How_to_create_a_Virtual_Host.3f

As a result we see at the bottom of our file: /opt/bitnami/apache2/conf/httpd.conf the following was added (later corrected later by placing a # before every line from <virtualhost> to </virtualhost> :

Include "/opt/bitnami/apache2/conf/bitnami/httpd.conf"
Include "/opt/bitnami/apps/drupal/conf/drupal.conf"
            Include "/opt/bitnami/apps/joomla/conf/joomla.conf"
Include "/opt/bitnami/apps/moodle/conf/moodle.conf"
Include "/opt/bitnami/apps/wordpress/conf/wordpress.conf"
Include "/opt/bitnami/apps/tattler/conf/tattler.conf"
Include "/opt/bitnami/apps/ocportal/conf/ocportal.conf"

<VirtualHost *:80>
#DocumentRoot /opt/bitnami/apps/drupal/htdocs/sites/abcd.com/htdocs
#ServerName abcd.com
#<Directory "/opt/bitnami/apps/drupal/htdocs/sites/abcd.com/htdocs">
#allow from all
#Options +Indexes
#</Directory>
</VirtualHost>

NOTE: we needed for things to work to uncomment (by placing a # in every line) as above in VirtualHost.

In the following file on our Server /opt/bitnami/apps/drupal/conf/drupal.conf we see:

Alias /drupal/ "/opt/bitnami/apps/drupal/htdocs/"
Alias /drupal "/opt/bitnami/apps/drupal/htdocs"

<Directory "/opt/bitnami/apps/drupal/htdocs">
    Options Indexes MultiViews
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

# Uncomment the following lines to see your application in the root
# of your URL. This is not compatible with more than one application.
#RewriteEngine On
#RewriteRule ^/$ /drupal/ [PT]

Initially we were somewhat confused by not finding a virtualhost.conf (not needed) file in the location /opt/bitnami/apps/virtalhost.conf as the following instructions at Wiki Bitnami mention the need to create or adjust this file: http://wiki.bitnami.org/Components/Apache#How_to_create_a_Virtual_Host.3f

Question: Are we also correct in assuming that the DocumentRoot of abcd.com is a site specific htdocs: /opt/bitnami/apps/drupal/htdocs/sites/abcd.com/htdocs or alternatively the "generic" (non domainname specific) /opt/bitnami/apps/drupal/htdocs as has been suggested elsewhere in various Drupal literature ?? We have decided to go for the generic htdocs but are not a 100 % sure though ..... !!

Also suggested is that the drupal.conf file should be edited by uncommenting or removing the "Alias" entries in the drupal.conf file ? (# Uncomment the following lines to see your application in the root # of your URL. This is not compatible with more than one application.

#RewriteEngine On
#RewriteRule ^/$ /drupal/ [PT])

Will uncommenting or removing the "Alias" mean that all domainnames (also those domainnames now connected to WordPress webpages) will standardly be 'tied' up to Drupal as this the 'one' application ? Latest news: uncommenting the above "alias" in the drupal.conf file does not change anything! Typing: www.abcd.com does not serve up the Drupal start page .....


To summarize: first we get Bitnami Drupal 'Multisite' properly configured for abcd.com and efgh.com and then in a separate Bitnami Wiki posting learn how to configure Moodle 'Multisite' for multiple domainnames. Once WP, Drupal, Moodle 'Multisite' set up is 'mastered' we can move on to mixing and matching these Bitnami Apps with a domainname (and subdomainname(s) like outlined under thirdly above.

A next challenge: how to set up WordPress Multisites no longer in root, and that typing www.domainname.com or //domainname.com in the browser serves up "//blog.domainname.com" with a WordPress website for that blog subdomainname? Could we similarly get our Moodle application installed on our server set up to serve up "//moodle.domainname.com" in the moodle subdomain name ?


Our corrected Wordpress.conf file text is now:

Note: that a ServerAlias has to be added below ServerName with www.jkk.com !

 NameVirtualHost *:80

<VirtualHost *:80>
 ServerAdmin xyz@gmail.com
DocumentRoot /opt/bitnami/apps/wordpress/htdocs
ServerName jkk.com
ServerAlias www.jkk.com

<Directory "/opt/bitnami/apps/wordpress/htdocs">
   Options Indexes MultiViews +FollowSymLinks
   AllowOverride all
   Order allow,deny
   Allow from all

   RewriteEngine On
   RewriteBase /
   RewriteRule ^index\\.php$ - [L]

   # uploaded files
   RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]

   RewriteCond %{REQUEST_FILENAME} -f [OR]
   RewriteCond %{REQUEST_FILENAME} -d
   RewriteRule ^ - [L]
   RewriteRule . index.php [L]
 </Directory>
</VirtualHost>


Viewing all articles
Browse latest Browse all 2052

Trending Articles