In this page we will be configuring our Bitnami LAMP stack so that we can install our websites with domain names of our choice on our local host.
to
to
Note: We are installing for a local computer and the domain name that you create will be available only for your local computer and will not be available or can be accessed using a remote computer with the said domain.
Then we will be configuring our Drupal 7 and/or 8 to be multisite so that we can install multiple websites using same Drupal core base. Keeping our time short and simple for future installation and development.
So let get started...
I assume that you have already downloaded and installed Bitnami LAMP stack. If not you can download it from here <Bitnami LAMP stack>.
After installation of Bitnami LAMP stack is complete, you will find a folder named demo located inside docs within installed lamp stack folder. You can either copy that demo folder either inside app or you can copy to any other location withing your drive or external drive where you feel like keeping your code. One more thing you may want to rename that folder name from demo to something else like your client name, so that you can distinguish between each project.
Ok, so let us now assume we have a client, let name him 'Batman' who want two websites which we are going to build one for 'Arkaham' and another one for 'Gotham'. We took a copy of 'demo' folder from 'docs' to 'app' folder and renamed it to 'batman'.
Inside 'batman' folder you will find two other folders 'conf' and 'htdocs'.
'htdocs' is where we will keep our Drupal 7 or 8. OK so we download and extract Drupal 7 or 8 to this 'htdocs' folder. If you have all your extracted drupal files inside drupal-X.x folder move them one level up to 'htdocs' folder.
Next, inside our sites folder within drupal root, we find a file name 'example.sites.php'. We copy and rename it to sites.php and edit that file. At the very end of that file we add two new lines and save the file.
1 2 | $sites['arkaham.com'] = 'arkaham'; $sites['gotham.com'] = 'gotham'; |
Note: It would be recommended to go through the comment lines that you see within 'sites.php' file.
Next we copy default folder and make two copies named 'arkaham' and 'gotham' within 'sites' directory. That all with our drupal configuration for multisite. When we visit our client website on arkaham.com, Drupal now understands that it need to get infomation from 'arkaham' folder and not 'default' folder. Same goes for our 'gotham'.
So next we create our own local .com domains.
We go back to 'conf' folder that we saw earlier within our 'batman' folder. Inside 'conf' folder you will find three files. We will be editing each of them.
In 'httpd-app.conf' file we renamed the demo folder to batman.
1 2 3 4 5 6 7 8 9 10 11 | <Directory "INSTALLDIR/apps/demo/htdocs"> Options Indexes MultiViews AllowOverride All <IfVersion < 2.3 > Order allow,deny Allow from all </IfVersion> <IfVersion >= 2.3> Require all granted </IfVersion> </Directory> |
to
1 2 3 4 5 6 7 8 9 10 11 | <Directory "INSTALLDIR/apps/batman/htdocs"> Options Indexes MultiViews AllowOverride All <IfVersion < 2.3 > Order allow,deny Allow from all </IfVersion> <IfVersion >= 2.3> Require all granted </IfVersion> </Directory> |
In 'httpd-prefix.conf' file removed one of the alias and modified antoher alias so that it instead of pointing to demo folder it points directly to our 'htdocs' inside 'batman' and renamed all occurrence of 'demo' to 'batman'.
1 2 3 4 | Alias /demo/ "INSTALLDIR/apps/demo/htdocs/" Alias /demo "INSTLLDIR/apps/demo/htdocs" Include "INSTALLDIR/apps/demo/conf/httpd-app.conf" |
to
1 2 3 | Alias / "INSTALLDIR/apps/batman/htdocs" Include "INSTALLDIR/apps/batman/conf/httpd-app.conf" |
In 'httpd-vhosts.conf' we modfied the lines so that our domain point to appropriate directory when accessed and renamed 'demo' to 'batman'.
1 2 3 4 5 | <VirtualHost *:80> ServerName demo.example.com DocumentRoot "INSTLLDIR/apps/demo/htdocs" Include "INSTLLDIR/apps/demo/conf/httpd-app.conf" </VirtualHost> |
to
1 2 3 4 5 6 7 8 9 10 | <VirtualHost *:80> ServerName arkaham.com
DocumentRoot "INSTLLDIR/apps/demo/htdocs" Include "INSTLLDIR/apps/demo/conf/httpd-app.conf" </VirtualHost> <VirtualHost *:80> ServerName gotham.com DocumentRoot "INSTLLDIR/apps/demo/htdocs" Include "INSTLLDIR/apps/demo/conf/httpd-app.conf" </VirtualHost> |
Next after configuring the files we need to tell apache that these conf files exits somewhere in our drive. So next we move to 'apache2' directory located within our lampstack install directory, there we will find 'bitnami' directory placed inside 'conf' directory.
We will define our configuration file location within these files that we can find inside 'bitnami' directory.
In 'bitnami-apps-prefix.conf' we will add a new line at the end of file pointing it to our own configured 'httpd-prefix.conf' file
In 'bitnami-apps-vhosts.conf' file we will add a line that will point to our configured 'httpd-vhosts.conf' file.
OK, that is all with our Apache configuration. Next we need to define our domain so that our system recognizes it whenever we try to access that domian using localloop address i.e. 127.0.0.1.
So for that we use terminal as we may need sudoer permission and edit 'hosts' file located within /etc.
OK, there it is our final step. Restart apache.
Now you see the magic. Your multisite drupal configuration in localhost with custom domain is ready and set to go for installation.
Note: You may have to copy and rename the default.settings.php to settings.php.
Note: You can perform multisite installation in your hosting account in similar fashion. The only points that you may need to note is that
1 . Drupal root directory should be at top (within public_html or htdocs or default or html).
2. Create a copy and rename the file example.sites.php to sites.php.
3. All your multisite domain name should point to this root directory.
You can also create subdomain based installation in similar fashion. You can get note of it if you go through sites.php commented docs.
For more information refer:
INSTALL.txt/7.x
INSTALL.txt/8.2.x
example.sites.php/7.x
example.sites.php/8.2.x
Multi-site - Sharing the same code base
Configuring a basic multi-site development environment in Linux
We will define our configuration file location within these files that we can find inside 'bitnami' directory.
In 'bitnami-apps-prefix.conf' we will add a new line at the end of file pointing it to our own configured 'httpd-prefix.conf' file
1 | Include "INSTALLDIR/apps/batman/conf/httpd-prefix.conf" |
In 'bitnami-apps-vhosts.conf' file we will add a line that will point to our configured 'httpd-vhosts.conf' file.
1 | Include "INSTALLDIR/apps/batman/conf/httpd-vhosts.conf" |
OK, that is all with our Apache configuration. Next we need to define our domain so that our system recognizes it whenever we try to access that domian using localloop address i.e. 127.0.0.1.
So for that we use terminal as we may need sudoer permission and edit 'hosts' file located within /etc.
1 | 127.0.0.1 arkaham.com gotham.com |
OK, there it is our final step. Restart apache.
Now you see the magic. Your multisite drupal configuration in localhost with custom domain is ready and set to go for installation.
Note: You may have to copy and rename the default.settings.php to settings.php.
Note: You can perform multisite installation in your hosting account in similar fashion. The only points that you may need to note is that
1 . Drupal root directory should be at top (within public_html or htdocs or default or html).
2. Create a copy and rename the file example.sites.php to sites.php.
3. All your multisite domain name should point to this root directory.
You can also create subdomain based installation in similar fashion. You can get note of it if you go through sites.php commented docs.
For more information refer:
INSTALL.txt/7.x
INSTALL.txt/8.2.x
example.sites.php/7.x
example.sites.php/8.2.x
Multi-site - Sharing the same code base
Configuring a basic multi-site development environment in Linux
No comments:
Post a Comment