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.
- Extract downloaded package again:
unzip Joomla_2.5.1-Stable-Full_Package.zip
- Create New Joomla directory
- Move all files to home web directory:
mv /joomla/* /var/www/html/secondjoomla
- Create second Joomla User (note that these are two separate commands):
mysql -u root -p
CREATE USER 'SecondJoomlaUser'@'localhost' IDENTIFIED BY 'mypass'; - Create second Joomla Database:
mysqladmin -u root -p create SecondJoomla
- Provide appropriate privileges to the second Joomla User user (note that these are two separate commands):
mysql -u root -p
GRANT ALL PRIVILEGES ON SecondJoomla.*
TO SecondJoomlaUser@localhost IDENTIFIED BY 'mypass';
where:
'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 - Apply privileges and exit:
flush privileges; \q
- Create empty configuration.php file and set permissions:
touch /var/www/html/secondjoomla/configuration.php
chmod 666 /var/www/html/secondjoomla/configuration.php - 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.
- Ensure config syntax is ok and restart Apache.
- You can now start the Second Joomla install proper by navigating to:
http://www.example2.com
- On step 4 use the following settings:
- Ensure that you remove the installation directory
rm -rf /var/www/html/secondjoomla/installation/
- You can now go and administer your second site or view the sample sites if you chose to install the sample data. Enjoy!
mkdir /var/www/html/secondjoomla
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin webmaster@example1.com
DocumentRoot /var/www/html
ServerName example1.com
ServerAlias www.example1.com
ErrorLog logs/example1.com-error_log
CustomLog logs/example1.com-access_log common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster@example2.com
DocumentRoot /var/www/html/secondjoomla
ServerName example1.com
Serveralias www.example2.com
ErrorLog logs/example1.com-error_log
CustomLog logs/example1.com-access_log common
</VirtualHost>
apachectl -S
apachectl restart
Please note that in order to test this setup (two Joomla websites), the machine browsing to the joomla websites must be able to resolve example1.com and example2.com, 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.
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