Views: 2003 (Data available since 06.02.2017)
In order to make multiple site work in different domains we will have to set up the software. Apache web server shall be configured by a hosting company; the same is true for multiple site in one domain.
Let us take a two site configuration as an example:
- www.site1.com - company’s corporate site
- www.site2.com - company’s e-store
Setup of Multiple Site in Different Domains
Each website should be located in the relevant catalog, e.g.:
Installing Software and Setup of Symbolic Links
The software is set in one of the sites. To make the kernel work for both sites you have to create symbolic links for the site where the kernel is not installed. The links will be required for the folders
It is possible to simply copy the said folders from the first site to the second. Such copying will result in two copies of the kernel working with the same database. This option will work, but it has two disadvantages: technical and legal. The technical problem is that after updating one of the kernels the database will be updated, and the second website will fail. The legal problem is that kernel copying contradicts the product license.
Copying of the said folders to an external folder to which symbolic links are configured for all websites is technically possible (but not recommended).
A special file for which no information is stored in the file system except one text line. This line is interpreted as a path to the file which must be opened upon an attempt to access such link.
In practice, symbolic links are used for the more convenient organization of the file structure on the computer because they make it possible for one file or catalog to have several names and are free from certain limits common for hard links (which operate only within one section and cannot refer to catalogs).
There are to options to set the links. The first option is a classic option recommended by the company from the very beginning. The second option is a later addition and is considered more "beautiful and sophisticated". It omits the step of the creation of a separate folder and transfer of the system kernel into it.
First option (examples of installation on UNIX systems are marked in green):
- Install "Bitrix Site Manager" first to the catalog of the first site
- Create the catalog
/home/www/shared/ where the files that are common for all the websites will be located:
- Move the entire catalogă
mv /home/www/site1/bitrix /home/www/shared/bitrix
- Move the entire catalog
mv /home/www/site1/upload /home/www/shared/upload
- Create symbolic link for the catalog
/bitrix/ in every website:
- ln -s /home/www/shared/bitrix /home/www/site1/
- ln -s /home/www/shared/upload /home/www/site1/
- ln -s /home/www/shared/bitrix /home/www/site2/
- ln -s /home/www/shared/upload /home/www/site2/
- Make sure webserver (Apache, IIS) has the right to write into the catalog
/home/www/shared/ (it will be necessary for the operation of the update system and loading image files)
- Place the public part of the second website into the catalog
Additional software should be used in order to create symbolic links in Windows, e.g. Far Manager or Junction from Sysinternals.
FAT32 file system does not support the creation of symbolic links.
The following program method can be used to create symbolic links when creating a multiple site configuration at UNIX:
Sometimes, for example when web server works in chroot, relative links shall be created.
/var/www/s1 - first website
/var/www/s2 - second website
/var/www/shared - folder containing system kernel
/var/www/s1 and create links:
ln -s ../shared/bitrix bitrix
ln -s ../shared/upload upload
and run the same commands.
Second option. Symbolic links are created directly in the folder of the second website.
- Install Bitrix Site Manager first in the catalog of the first website
- Create a script in the root folder of the second website (
/home/www/site2/); name it, for example, symlink.php:
<head><title>Create links to the folders bitrix and upload</title></head>
error_reporting(E_ALL & ~E_NOTICE);
$path = rtrim($_POST['path'],"/\\");
$path = '../site2/www';
$full_path = $path;
$full_path = realpath($_SERVER['DOCUMENT_ROOT'].'/'.$path);
$strError = "The current folder already contains the folder bitrix";
echo "<font color=green>Symbolic links are created successfully</font>";
$strError = 'Cannot create the link to the folder upload, please contact the server administrator';
$strError = 'Cannot create the link to the folder bitrix, please contact the server administrator';
$strError = 'The indicated path does not contain the folder bitrix';
$strError = 'Wrong path or access rights error';
echo '<font color=red>'.$strError.'</font><br>Source path: '.$full_path;
Path to the folder containing folders bitrix and upload: <input name=path value="<?=htmlspecialchars($path)?>"><br>
<input type=submit value='Create' name=create>
- Run the script and indicate the path to the root folder of the first website, in our case
- Once symbolic links are created, type in the browser’s address bar
site1/bitrix/admin. The authorization panel opens.
- Type the administrator’s data indicated when installing the product to the first website, and you will be redirected to the administrative panel of Bitrix Site Manager.
When script operation is completed, the symbolic links to the folders
/upload n the folder of the second website become available. Their availability can be easily verified because the folders with the same names appear.
The following problems may arise at the creation stage:
- Absence of rights to write in the current folder;
- Security restriction (open_basedir) which prohibits users of a shared hosting from addressing other websites.
Contact your host should any problems arise with this script.
Website are configured in the administrative section of the system on the page Control Panel > Settings > System settings > Websites > Websites.
Let us set up the first site (www.site1.com):
- Name: site1
- Domain: www.site1.com
- Site folder: /
- Website name: Corporate Website of "Company Name"
- Server URL: www.site1.com
- Path to the web server root folder of this site: /home/www/site1/
If DNS is configured so that your website responds to the address http://site1.com, it is better to omit www in the field Domain. You can enumerate any number of domain names you wish your website to respond to (or which your website already responds) using a new line in this field.
It is important to keep in mind that the product uses the values indicated in the field Domain to submit to the indicated domains the information about visitors using the technique of transfer of visitors. That is why it is strongly recommended that a complete list of domains which the website can respond to should be indicated.
It is very important not to indicate websites which do not work on this product copy in the list of domains. Incorrectly indicated or inexistent domain may slow down users’ experience as well as actually prevent transferring data to the websites not working on the shared product copy.
Set up the parameters of the second website following the same pattern (www.site2.com/):
- Name: site2
- Name: site2.com
- Site folder: /
- Website name: E-Store of "Company Name"
- Server URL: www.site2.com
- Path to the web server root folder of this site: /home/www/site2/
Please note that the same value "/" is indicated in the parameter Site folder for both websites. This is because the sites are serviced by different "virtual servers" (using Apache terms) which have different catalogs for the layout of files.
Also pay attention to the parameter Path to the web server root folder of this site. It has a different value for different websites taken from the parameter DocumentRoot of settings of the relevant "virtual server" (see an example of a part of the file httpd.conf of the Apache settings below).
When it comes to organizing multisiting using this option, you can use both virtual servers of one Apache unit and different Apache units. This is also true for other web servers: IIS, EServ, etc.
Important: When creating the second website you have to copy from the main website or create anew the files
Create the file .access.php with the following contents in the root of the second website:
<? $PERM["/"]["*"]="R"; ?>
Unlike Pseudomultisiting, for this option of multisiting setting website selection algorithm on the index page is not required because the website will be unambiguously defined according to the Domain field.
Configuration is ready for operation.
- Type in the browser address bar http://site1/bitrix/admin (or http://site2/bitrix/admin). The authorization panel will open.
- Enter administrator’s data which you have indicated when installing product on the first site, and then you will access the administrative panel of Bitrix Site Manager
Since the kernel and the base are the same, the administrative panel for both websites will be the same.
Technically, the system permits creating any number of websites working pursuant to this principle. For each new website, a web server must be set up and a symbolic link must be created. Legally, an additional coupon must be acquired in order to create each new website (except for the first two websites).
Note: HTML cache is not supported with multisiting organized according to the second option.