# Configure multi-regional deployment

To configure the delivery of static personalized content in multiple regions, you need to make several adjustments to some of the configuration files.

# Configure multi-regional deployment with authentication

## 1. Modify the Web.config file

Open the web.config file of all Sitefinity CMS instances that are part of the Primary and the Secondary region and make the following configurations:

* Turn on read-only mode of configurations, by adding `restrictionLevel` in section `<telerik>`.
* Ensure that all Sitefinity CMS instances in each region have the same values for `machineKey` property.

> success **EXAMPLE**: Use the following configuration for the **Primary region** and the **Secondary region(s)**.\
> The `<telerik>` section of all Sitefinity CMS instances that are in the primary and the secondary regions, should look in the following way:
>
> ````XML
> <telerik>
>     <sitefinity>
>        <sitefinityConfig storageMode="Auto" restrictionLevel="ReadOnlyConfigFile" />
>  </sitefinity>
> </telerik>
> ```# Configure multi-regional deployment
> ````

##

2. Modify the DataConfig.config file

Open the `DataConfig.config` file and make the following configurations:

* Define the connection strings to the primary, the secondary, and the session database.\
  The *Primary region* must have a connection to the *Primary database* and the *Session database*. The *Secondary region* should have a connection to the *Secondary database* and the *Session database*.
* Define the replication type.\
  You should set the *Primary database* to have `replication="Master"` and the *Secondary database* to have `replication="Slave"`.
* Define the read-only state.\
  The *Primary database* must not be read-only, while the *Secondary database* must be read-only.

> success **EXAMPLE**: Use the following samples for the configuration of both regions:
> **Primary region**: The `DataConfig.config` file of all Sitefinity CMS instances that participate in the *Primary region* should look in the following way:
>
> ```XML
> <?xml version="1.0" encoding="utf-8"?>
> <dataConfig xmlns:config="urn:telerik:sitefinity:configuration" xmlns:type="urn:telerik:sitefinity:configuration:type" initialized="True">
>    <connectionStrings>
>        <add connectionString="" dbType="SqlAzure" replication="Master" readOnly="false" name="Sitefinity" />
>        <add connectionString="" dbType="SqlAzure" name="SessionConnection" />
>    </connectionStrings>
> </dataConfig>
> ```
>
> **Secondary region(s)**: The `DataConfig.config` file of all Sitefinity CMS instances that participate in the *Primary region* should look in the following way:
>
> ```XML
> <?xml version="1.0" encoding="utf-8"?>
> <dataConfig xmlns:config="urn:telerik:sitefinity:configuration" xmlns:type="urn:telerik:sitefinity:configuration:type" initialized="True">
>    <connectionStrings>
>        <add connectionString="" dbType="SqlAzure" replication="Slave" readOnly="true" name="Sitefinity" />
>        <add connectionString="" dbType="SqlAzure" name="SessionConnection" replication="None" />
>    </connectionStrings>
> </dataConfig>
> ```

> info **NOTE**: Take note of the following configurations:
>
> * The `replication="Master"` attribute is mandatory in the database connection string for the *Primary region*.
> * The `replication="Slave"` attribute is mandatory in the database connection string for the *Secondary region(s)*.
> * The `replication="None"` attribute in the *Session database* connection string is not required and could be omitted.

## 3. Modify the LibrariesConfig.config file

Open the `LibrariesConfig` file of the Secondary region and for every Sitefinity CMS instance that is part of the region, disable dynamic resizing of images, because it requires database writes operations.

> success **EXAMPLE**: Use the following configuration for the *Secondary region(s)*.\
> The `LibrariesConfig.config` file of all Sitefinity CMS instances that are part of the *Secondary region*, should look like this:
>
> ```XML
> <?xml version="1.0" encoding="utf-8"?>
> <librariesConfig xmlns:config="urn:telerik:sitefinity:configuration" xmlns:type="urn:telerik:sitefinity:configuration:type">
>    <images allowDynamicResizing="False" storeDynamicResizedImagesAsThumbnails="False" />
>        <providers>
>        <add connectionString="Sitefinity" name="OpenAccessDataProvider" config:flags="1" />
>    </providers>
> </librariesConfig>
> ```

> info  **NOTE**: If you do not have a `LibrariesConfig.config` file, create one and place it in folder `~\App_Data\Sitefinity\Configuration`.

# Configure multi-regional deployment with authentication

## 4. Modify the SchedulingConfig.config file

Open the `SchedulingConfig` file of the *Primary* and the *Secondary* *region* and for every Sitefinity CMS instance that is part of the respective region, reconfigure the config file to use the respective Session database, which is dedicated per region.

> success **EXAMPLE**: Use the following configuration for the *Primary region* and the *Secondary region(s)*.\
> The `SchedulingConfig.config` file of all Sitefinity CMS instances that are part of the *Primary* and the *Secondary region*, should look like this:
>
> ```XML
> <?xml version="1.0" encoding="utf-8"?>
> <schedulingConfig xmlns:config="urn:telerik:sitefinity:configuration" xmlns:type="urn:telerik:sitefinity:configuration:type">
>    <providerSettings>
>        <add connectionString="SessionConnection" name="OASchedulingProvider" config:flags="1" />
>    </providerSettings>
> </schedulingConfig>
> ```

> info **NOTE**: If you do not have a `SchedulingConfig.config` file, create one and place it in folder `~\App_Data\Sitefinity\Configuration`.

##

5. Modify the StatisticsConfig.config file

Statistics must be stored in the respective *Session database*. Open the `StatisticsConfig.config` file of the *Primary* and the *Secondary region* and for every Sitefinity CMS instance that is part of the respective region, reconfigure the config file to use the respective *Session database*, which is dedicated per region.

> success **EXAMPLE**: Use the following configuration for the *Primary region* and the *Secondary region(s)*.\
> The `StatisticsConfig.config` file of all Sitefinity CMS instances that are part of the *Primary* and the *Secondary region*, should look like this:
>
> ```XML
> <?xml version="1.0" encoding="utf-8"?>
> <statisticsConfig xmlns:config="urn:telerik:sitefinity:configuration" xmlns:type="urn:telerik:sitefinity:configuration:type">
>    <providers>
>        <add connectionString="SessionConnection" name="OpenAccessDataProvider" config:flags="1" />
>    </providers>
> </statisticsConfig>
> ```

> info  **NOTE**: If you do not have a `StatisticsConfig.config` file, create one and place it in folder `~\App_Data\Sitefinity\Configuration`.

## 6. Modify the UserActivityConfig.config file

User activities must be stored in the respective Session database. Open the `UserActivityConfig.config` file of the *Primary* and the *Secondary region* and for every Sitefinity CMS instance that is part of the respective region, reconfigure the config file to use the respective *Session database*, which is dedicated per region.

> success **EXAMPLE**: Use the following configuration for the *Primary region* and the *Secondary region(s)*.\
> The `UserActivityConfig.config` file of all Sitefinity CMS instances that are part of the *Primary* and the *Secondary region*, should look like this:
>
> ```XML
> <?xml version="1.0" encoding="utf-8"?>
> <userActivityConfig xmlns:config="urn:telerik:sitefinity:configuration" xmlns:type="urn:telerik:sitefinity:configuration:type">
>    <providers>
>        <add connectionString="SessionConnection" name="OpenAccessUserActivityProvider" config:flags="1" />
>    </providers>
> </userActivityConfig>
> ```

> info  **NOTE**: If you do not have a `UserActivityConfig.config` file, create one and place it in folder `~\App_Data\Sitefinity\Configuration`.# Configure multi-regional deployment

## 7. Modify the SystemConfig.config file

Open the `SystemConfig.config` file and make the following configurations:

* Enable synchronization across the regions.
* Set the connection string to the Redis instance used as a communication channel between the regions.
* Define a prefix for cache records.
* Disable the backend UI of the *Secondary region*.

> success **EXAMPLE**: Use the following samples for the configuration of both regions:
> **Primary region**: The `SystemConfig.config` file of all Sitefinity CMS instances that participate in the *Primary region* should look in the following way:
>
> ```XML
> <?xml version="1.0" encoding="utf-8"?>
> <systemConfig xmlns:config="urn:telerik:sitefinity:configuration" xmlns:type="urn:telerik:sitefinity:configuration:type" disableBackendUI="False" >
>    <loadBalancingConfig>
>        <replicationSyncSettings Enabled="True">
>            <Transporter>
>                <add ConnectionString="***************" Prefix="sf-replication" TypeName="Telerik.Sitefinity.LoadBalancing.Replication.RedisMessageTransporter" config:flags="1" />
>            </Transporter>
>        </replicationSyncSettings>
>    </loadBalancingConfig>
> </systemConfig>
> ```
>
> **Secondary region(s)**: The `SystemConfig.config` file of all Sitefinity CMS instances that participate in the *Secondary region* should look in the following way:
>
> ```XML
> <?xml version="1.0" encoding="utf-8"?>
> <systemConfig xmlns:config="urn:telerik:sitefinity:configuration" xmlns:type="urn:telerik:sitefinity:configuration:type" disableBackendUI="True" >
>    <loadBalancingConfig>
>        <replicationSyncSettings Enabled="True">
>            <Transporter>
>                <add ConnectionString="***************" Prefix="sf-replication" TypeName="Telerik.Sitefinity.LoadBalancing.Replication.RedisMessageTransporter" config:flags="1" />
>            </Transporter>
>        </replicationSyncSettings>
>    </loadBalancingConfig>
> </systemConfig>
> ```

> info  **NOTE**: If you do not have a `SystemConfig.config` file, create one and place it in folder `~\App_Data\Sitefinity\Configuration`.

# Configure multi-regional deployment

## 10. Modify the SecurityConfig.config file

Open the `SecurityConfig.config` of each Sitefinity CMS instance in the *Primary region* and the *Secondary region(s)* and make sure that all Sitefinity CMS instances in each region have exactly the same values for `authCookieName`, `rolesCookieName`, `loggingCookieName`, `validationKey`, and `decryptionKey` properties.

## 11. Restart the application.

Restart Sitefinity CMS by restarting the IIS application pool.
