Monday, 4 February 2013

Multiple installations of Joomla in single server.

This has been asked multiple times, How do I host multiple installs of Joomla in a single server? in this post, actually only once, but I thought I would answer it properly here.

I am going to assume that you have followed my guide to install Joomla, here, which means that you already have a working instance of Joomla.

Note that while the original post was for CentOS 6.x, it also works fine for Amazon Linux AMI as long as you remember to sudo most commands and indeed RHEL 6. I've left sudo out of the commands to keep it more general.
  1. Extract downloaded package again:
  2. Create New Joomla directory
  3. mkdir /var/www/html/secondjoomla
  4. Move all files to home web directory:
    mv /joomla/* /var/www/html/secondjoomla
  5. Create second Joomla User (note that these are two separate commands):
    mysql -u root -p
    CREATE USER 'SecondJoomlaUser'@'localhost' IDENTIFIED BY 'mypass';
  6. Create second Joomla Database:
    mysqladmin -u root -p create SecondJoomla
  7. Provide appropriate privileges to the second Joomla User user  (note that these are two separate commands):
    mysql -u root -p
                    TO SecondJoomlaUser@localhost IDENTIFIED BY 'mypass';
            'SecondJoomla' is the name of your database
            'SecondJoomlaUser@localhost' is the userid of your webserver MySQL account
            'mypass' is the password required to log in as the MySQL user
  8. Apply privileges and exit:
    flush privileges; \q
  9. Create empty configuration.php file and set permissions:
    touch /var/www/html/secondjoomla/configuration.php
    chmod 666 /var/www/html/secondjoomla/configuration.php
  10. Set up Virtual Hosts in Apache. You will need to edit /etc/httpd/conf/httpd.conf. You can find a sample below. Ensure that the first directive has been uncommented.
  11. NameVirtualHost *:80 
    <VirtualHost *:80>
     DocumentRoot /var/www/html
     ErrorLog logs/
     CustomLog logs/ common
    <VirtualHost *:80>
     DocumentRoot /var/www/html/secondjoomla
     ErrorLog logs/
     CustomLog logs/ common
  12. Ensure config syntax is ok and restart Apache.
  13. apachectl -S
    apachectl restart
  14. You can now start the Second Joomla install proper by navigating to:
  15. On step 4 use the following settings:
  16. Ensure that you remove the installation directory
    rm -rf /var/www/html/secondjoomla/installation/
  17. You can now go and administer your second site or view the sample sites if you chose to install the sample data. Enjoy!
Please note that in order to test this setup (two Joomla websites), the machine browsing to the joomla websites must be able to resolve and, or whatever domain names are being used.
Ordinarily this is done by a DNS server, but the above entries can be added to the hosts file. It is imperative that all devices accessing the website are able to resolve those names, otherwise the first website (example1) will be displayed.

No comments:

Post a Comment