Sophie

Sophie

distrib > Mandriva > 9.2 > i586 > by-pkgid > 1999a7b047259f6bbf9513bce6e6be29 > files > 84

twig-2.7.7-1mdk.noarch.rpm

TWIG has built in support for virtual hosting, allowing a single TWIG
installation to serve different content to multiple domains.  This
document covers the setup of TWIG to support virtual hosts.  For
information on configuring your web server for virtual hosting, please
refer to your web server's documentation.

Virtual hosts are defined in TWIG by defining values for the $vhosts[]
array.  An example of how to do this is included in the default
config/config.inc.php3 file.  To enable virutal hosting, uncomment the
$vhosts line in the config file by removing the "//" at the beginning of
the line.  Then replace <server_name> with the name that your web server
will provide as the SERVER_NAME for a given virtual host.  For example,
for a virtual host called "virtualdomain.com" the line would look like
this:

	$vhosts["virtualdomain.com"] = "config/virtualdomain.com";

Any directory may be defined as the config directory for a given virtual
host, but it generally makes sense to place the virtual host config
directories under TWIG's config/ directory.  The path of the directory
is relative to the directory into which TWIG is installed.  Any file found
in the config/ directory may then be placed in the virtual host
configuration directory.  These files will override the base configuration
found in config/.  The configuration files in the virtual host config
directory need not be complete copies of the ones in the config/
directory.  They only need to define any variables which should be
different from that found in the file in the base configuration.  No files
are required in the virtual host directory, but any file placed there will
be used.

For example, consider a host "somehost.com" that is also hosting
"virtualhost1.com" and "virtualhost2.com".  "somehost.com" would be
configured normally using the files in the config/ directory of TWIG.  Its
config/config.inc.php3 file should contain the following lines:

	$vhosts["virtualhost1.com"] = "config/virtualhost1.com";
	$vhosts["virtualhost2.com"] = "config/virtualhost2.com";

This would setup config directories for the two virtual hosts.  If
virtualhost1.com was setup to use the same users and database as
somehost.com, and only the $config["fromdomain"] was to be different, then
all that would be necessary is to create the file
config/virtualhost1.com/config.inc.php3 containing the following line:

	<?php $config["fromdomain"] = "virtualhost1.com"; ?>

Now suppose virtualhost2.com had an entirely different set of users on an
entirely different mail server.  Then all that would need to be done would
be to create a config/virtualhost2.com/config.inc.php3 that includes the
following:

	<?php
		$config["fromdomain"] = "virtualhost2.com";
		$config["imap_server"] = "mail.virtualdomain2.com";
	?>

create a config/virtualhost2.com/dbconfig.inc.php3 file that contains the
following line:

	<?php $dbconfig["defaultdb"] = "twig_virtualhost2"; ?>

and then create the twig_virtualhost2 database in the database server
using the same database installation method used for the base
configuration.

Of course the configurations can vary as much or as little as needed, with
different auth providers, session types, default languages, mailfooters,
login pages, announcements, or anything else that is configured in the
config/ directory.

Any connection to a SERVER_NAME that does not match a $vhosts[] value will
simply be treated as a connection to somehost.com, and only the files in
the config/ directory will be used.  It is therefore wise to have a valid
TWIG setup in the config/ directory even if all anticipated connections
will be to virtual hosts.

There are basically three types of files in the config directories, and
each is handled slightly differently.

Type 1: Standard config files
=============================
config.inc.php3
dbconfig.inc.php3
defaults.inc.php3
images.inc.php3

These files simply define configuration variables.  If these files exist
in the virtual host configuration directory, any values contained therein
will override the values set by the corresponding file in the config/
directory.  Values not set by the files in the virtual host config 
directory will default to the values set by the files in the config/
directory.

Type 2: Required included files
===============================
footer.inc.php3
header.inc.php3
login.footer.inc.php3
login.form.inc.php3
login.header.inc.php3
mainmenu.inc.php3
newusergroups.inc.php3

These are files that are required for TWIG to operate correctly.  This
does not mean that they have to exist in each virtual host configuration
directory, but if they do not exist in a virtualhost directory, the
corresponding file in the config/ directory will be used instead.

Type 3: Non-required included files
===================================
announcements.inc.php3
mailfooter.inc.php3

These are files that are not required, but cause TWIG to behave
differently if they exist.  If these files do not exist in the virtual
host config directory, they are NOT loaded from the config/ directory.

Note:  Throughout this file, the base configuration directory has
been described using its default value "config/"  However, the base
configuration directory may be changed easily by modifying the line in
index.php3 which reads:

$config_dir = "config/";

and changing "config/" to another path where your configuration files will
be stored.  The path defined there is relative to the TWIG directory.