1. Multi-site configurations for windows & ubuntu
1.1. Configurations on windows
1.1.1. Configure Hosts file: C:\windows\system32\Drivers\etc\
Following are configurations in hosts
file…
127.0.0.1 localhost
127.0.0.1 your-sub-site
1.1.2. Configure httpd-vhosts file: D:\xampp\apache\conf\extra
Following are configurations…
NameVirtualHost your-site: 80
NameVirtualHost your-sub-site: 80
<VirtualHost *:80>
DocumentRoot DIRECTORY: /xampp/htdocs
ServerName localhost
</VirtualHost>
<VirtualHost localhost: 80>
DocumentRoot DIRECTORY: /xampp/htdocs
ServerName localhost
</VirtualHost>
<VirtualHost your-sub-site: 80>
DocumentRoot DIRECTORY: /xampp/htdocs/your-site
ServerName your-sub-site
</VirtualHost>
1.1.3. Restart Servers
1.1.4. Database Settings
Create new database
and setup settings.php for your-sub-site.
Move settings.php in /sites/your-sub-site/
1.2. Configurations on Ubuntu server
1.2.1. Configure Hosts file: /etc/ ONLY FOR LOCAL SYSTEM
Following are configurations in hosts file…
127.0.0.1 localhost
127.0.0.1 your-sub-site
1.2.2. Create the New Virtual Host File
The next step is to set up the apache
configuration. Go to sites-available directory and make a copy of the file
“default” (naming it after your domain name) in the same directory:
sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/your-sub-site
1.2.3. Turn on Virtual Hosts
Open up the new config file:
sudo nano /etc/apache2/sites-available/your-sub-site
1.2.4. Set Server Name
We are going to set up a virtual host
in this file.
The first step is to insert a line for the ServerName under the ServerAdmin line.
The first step is to insert a line for the ServerName under the ServerAdmin line.
ServerName your-sub-site
1.2.5. Create Site Folder and Assign Proper Permissions
Create site folder in /site/sites/your-sub-site
1.2.6. Activate the Site
Now activate the host, with the built in apache shortcut:
sudo a2ensite your-sub-site
1.2.7. Restart Apache
We’ve made a lot of the changes to
the configuration, and the virtual host is set up. However none of the changes
that we made will take effect until Apache is restarted. Use following commands
to reload settings and restart apache:
sudo service apache2 reload
sudo service apache2 restart
1.2.8. Database Settings
Create new database and setup
settings.php for your-sub-site.
Move settings.php in /sites/your-sub-site/
1.2.9. Symlinks
Remove source (dsmstg.tchadv.com)
directory
ln -s destination-directory simlink-name
2. Steps to start a new site
Following are the
steps to follow to launch a new site.
2.1.Create new site folder in sites module
2.1.1. Building out the home site folder
The home
folder of the site contains
§
the settings.php file for the site
- any custom themes for the site
- any custom modules required for the site
- the files folder for the site
In multi-site
the sites are all subfolders of the "sites" directory.
Example:
{cloudmlm_home}/sites/mysite.com
On the
development environment this ends up being:
/var/www/cloudmlm/sites/mysite.com
2.2.Create a database dump (Core database)
2.2.1. Import database and create settings.php for site
2.2.2. Configuring settings.php
Make sure the
database line looks like:
$databases = array (
'default' =>
array (
'default' =>
array (
'database' => 'database_name',
'username' => 'database_user_name',
'password' => 'database_password',
'host' => 'host_server_ip',
'port' => '',
'driver' => 'mysql',
'prefix' => '',
),
),
);
2.3.Themes required for the site
As database of site is totally
separate so it will be possible to use different theme for sites. To change
theme of a site follow these steps
2.3.1. Copy core theme in site’s themes folder
/sites/{mysite.com}/themes/mytheme
2.3.2. Rename the theme with site name
2.3.3. Open admin interface and change the theme
2.3.4. Do changes/designing in theme
2.4.Modules required for the site
In case a site needs some
functionality in a different way will have to change the particular module or
write new module for that site. Following are steps to change a theme
2.4.1. Move/create module in site’s modules folder
/sites/{mysite.com}/modules/mymodule
2.4.2. Code and enable module
2.4.3. It will start working
2.5.Files folder
The files folder needs to be in
the subsite.
Note!
Do not check the file folder into version control.
No comments:
Post a Comment