HowTo:Configure MultiDomain iFolder Enterprise Server

From iFolder

Table of contents

Overview

This howto will walk you through the process of setting up multiple iFolder Enterprise domains on a single Linux server by using Apache virtual hosts. The idea behind having multiple domains is to allow an ISP or other interested party to partition users and iFolders into separate domains while utilizing a single physical server. Lets use the following graphic as an example:

Image:ServerMultiDomains.png

As you can see this single server has two domains setup. The users in the example.net domain can see each other and are allowed to share iFolders with each other. The users in the example.com domain can see each other as well and can share iFolders amongst themselves. However, the example.net users, iFolders, and system policies can't be accessed, shared or applied with the users from example.com and vice versa.

Assumptions

This document will focus on setting up a single server with multiple iFolder domains. Each iFolder domain will be configured on a unique IP address that has previously been assigned to the server. This howto is not designed to teach you the ins and outs of Apache virtual hosts, mod_mono directives, or setting up virtual network interfaces. If your interested in gaining a better understanding and knowledge of those topics, review the following links or google it:

  • The Apache 2.0 (http://httpd.apache.org/docs/2.0/vhosts/) and 2.2 (http://httpd.apache.org/docs/2.2/vhosts/) virtual host documentation
  • The mod_mono overview (http://www.mono-project.com/mod_mono) or the mod_mono man pages (ie "man mod_mono" from the server's console).
  • Virtual interfaces / Aliasing interfaces - Todo - Find documentation link

Performance Considerations

Keep in mind that each domain that is setup will consume additional system resources (Memory, CPU, Disk space, etc). So depending on your server hardware, system load, and usage patterns, the number of iFolder domains that you can successfully fit on a single piece of hardware will vary.

Configuring your Server

By default the iFolder Enterprise install sets up a single domain. Lets now go through the process of enabling another domain

Modify the main iFolder Apache configuration file

In order to add another domain, we will need to uncomment the following section and change the IP address to your server's secondary IP.

  • Change the following section of the /etc/simias/apache/ifolder_apache.conf from
#NameVirtualHost 127.0.0.1

#<VirtualHost 127.0.0.1>
#       DocumentRoot /var/lib/www/example.com
#       ServerName example.com
#       Include /etc/simias/apache/example.com/*.conf
#</VirtualHost>
  • To
NameVirtualHost 192.168.1.113

<VirtualHost 192.168.1.113>
#      DocumentRoot /var/lib/www/example.com
      ServerName example.com
      Include /etc/simias/apache/example.com/*.conf
</VirtualHost></b>

Notice that we left the DocumentRoot directive commented out. The DocumentRoot is optional and is not needed for a rudimentary iFolder Virtual Host. We also changed the 127.0.0.1 address to 192.168.1.113. You will want to replace the 192.168.1.113 address with the secondary ip address of your server.

Finally, make a mental note regarding this line:

 Include /etc/simias/apache/example.com/*.conf

Basically this directive points Apache to the guts of the example.com iFolder virtual host configuration.

Configure the Simias data directory

While this howto will use the default "/var/lib/example.com/simias" Simias data directory specified in the example.com simias_server.conf, you may want to change the path for your environment. Just remember whatever path you choose, the Apache process will need to have sufficient rights to the location.

  • The example.com Simias data directory configuration option is located in the /etc/simias/apache/example.com/simias_server.conf file. Below is a snippet of the file where the important changes are in bold:
Alias /simias10 "/usr/lib/simias/web"
AddMonoApplications examplesimias10 "/simias10:/usr/lib/simias/web"
MonoSetEnv examplesimias10 SimiasDataDir=/var/lib/example.com/simias
<Location /simias10 >
        MonoSetServerAlias examplesimias10
        Order allow,deny
        Allow from all
        SetHandler mono
</Location>

Create the Simias data directory

Since the example.com default directory doesn't actually exist, we will need to create it

 mkdir -p /var/lib/example.com/simias

Configure the example.com virtual host's iFolder Web Access

Will we need to make sure that we have the example.com iFolder Web Access configuration pointing to the correct IP address. This will allow the example.com iFolder Web Access to successfully access the example.com iFolder web services.

  • To do this we need to modify the /etc/simias/apache/example.com/ifolder_webaccess.conf. Change the snippet of the file from
Alias /ifolder "/usr/lib/simias/webaccess"
AddMonoApplications exampleifolder "/ifolder:/usr/lib/simias/webaccess"
MonoSetEnv exampleifolder SimiasUrl=http://example.com:80
<Location /ifolder >
       MonoSetServerAlias exampleifolder
       Order allow,deny
       Allow from all
       AddHandler mono asax aspx ascx asmx ashx
       DirectoryIndex Default.aspx index.html
</Location>
  • To
Alias /ifolder "/usr/lib/simias/webaccess"
AddMonoApplications exampleifolder "/ifolder:/usr/lib/simias/webaccess"
MonoSetEnv exampleifolder SimiasUrl=http://192.168.1.113
<Location /ifolder >
       MonoSetServerAlias exampleifolder
       Order allow,deny
       Allow from all
       AddHandler mono asax aspx ascx asmx ashx
       DirectoryIndex Default.aspx index.html
</Location>

Notice that we changed the example.com:80 address to the secondary ip address of our server.

Configure the example.com virtual host's iFolder Web Administration

Will we need to make sure that we have the example.com iFolder Web Administration configuration pointing to the correct IP address. This will allow the example.com iFolder Web Administration to successfully access the example.com virtual host's iFolder web services.

  • To do this we need to modify the /etc/simias/apache/example.com/ifolder_admin.conf file. Change the snippet of the file from
Alias /admin "/usr/lib/simias/admin"
AddMonoApplications exampleadmin "/admin:/usr/lib/simias/admin"
MonoSetEnv exampleadmin SimiasUrl=http://example.com:80
<Location /admin >
       MonoSetServerAlias exampleadmin
       Order allow,deny
       Allow from all
       AddHandler mono asax aspx ascx asmx ashx
       DirectoryIndex Default.aspx index.html
</Location>
  • To
Alias /admin "/usr/lib/simias/admin"
AddMonoApplications exampleadmin "/admin:/usr/lib/simias/admin"
MonoSetEnv exampleadmin SimiasUrl=http://192.168.1.113
<Location /admin >
       MonoSetServerAlias exampleadmin
       Order allow,deny
       Allow from all
       AddHandler mono asax aspx ascx asmx ashx
       DirectoryIndex Default.aspx index.html
</Location>

Notice that we changed the example.com:80 address to the secondary IP address of our server.


Copy the /etc/simias/bill contents to the Simias data directory

In a default installation when the iFolder server webservice receives an initial request, the server process checks the Simias data directory for necessary configuration files. If no files are found, the server then does a bootstrap process that consists of copying the contents from the /etc/simias/bill directory to the Simias data directory. Once the configuration files are copied, the iFolder server then reads the settings from the Simias data directory configuration into the data store. Since it is desirable for each domain to have unique characteristics, we will want to override this default behavior by manually copying the necessary configuration files to our example.com's Simias data directory

 cp -r /etc/simias/bill/* /var/lib/example.com/simias/

By manually copying these configuration files, this will allow us to make changes prior to the iFolder server reading the values into the data store. We will want to customize some values in the /var/lib/example.com/simias/Simias.config for our new example.com domain. Below is a snippet of the Simias.config with the modified values in bold:

<configuration>
  <section name="EnterpriseDomain">
    <setting name="ServerName" value="example.com iFolder Server" />
    <setting name="Description" value="example.com iFolder Enterprise Server" />
    <setting name="AdminName" value="example_admin" />
    <setting name="AdminPassword" value="example_simias" />
  </section>

Assign Apache ownership of Simias data directory

Ok, now we have all of the necessary files in place, lets give the Apache process ownership of the files.

SUSE Platforms

Use this command on SUSE platforms

 chown -R wwwrun:www /var/lib/example.com

Fedora and CentOS Platforms

Use this command on Fedora and CentOS platforms

 chown -R apache:apache /var/lib/example.com

Verifying that the new domain works

Ok, now we have all of the files in place, lets start Apache and test to see if things are working correctly by opening a browser and hitting the example.com iFolder web services directly. In a browser we will want to hit the following URL:

 http://192.168.1.113/simias10/DomainService.asmx

NOTE Remember to change 192.168.1.113 to the IP address you setup for your environment If things are working correctly you will be prompted to authenticate. At this point if you were using the example values shown in this howto, the username would be "example_admin" and the password would be "example_simias". If you are able to successfully login and see this page, this means the iFolder server is working correctly

Enlarge



Now lets test to make sure the the Web Administration and Web Access components are working as well.

  • Using a browser, access the iFolder Web Access
 http://192.168.1.113/ifolder
  • Open a browser and access the iFolder Web Administration
http://192.168.1.113/admin

NOTE Remember to change 192.168.1.113 to the IP address you setup for your environment

Setting up additional Virtual Hosts

This section of the howto will point out all of the variables that need to be taken into consideration when creating additional virtual hosts. For example's sake we will setup an example.net virtual host.

Create new example.net virtual host iFolder Configuration Files

The easiest way to do this is to make a copy of the existing example.com directory structure and it's files

 cp -R /etc/simias/apache/example.com /etc/simias/apache/example.net 

Modify the main iFolder Apache configuration file

Below is a snippet of the modified /etc/simias/apache/ifolder_apache.conf. We will want to add the example.net settings. Below is a snippet of the file where the appended example.net entry is in bold

Include /etc/simias/apache/default/*.conf  

NameVirtualHost 192.168.1.113 

<VirtualHost 192.168.1.113>
#       DocumentRoot /var/lib/www/example.com
        ServerName example.com
        Include /etc/simias/apache/example.com/*.conf
</VirtualHost>

NameVirtualHost 192.168.1.114

<VirtualHost 192.168.1.114>
        DocumentRoot /var/lib/www/example.net
        ServerName example.net
        <Directory "/var/lib/www/example.net">
                Options None
                AllowOverride None
                Order allow,deny
                Allow from all
        </Directory>
        Include /etc/simias/apache/example.net/*.conf
</VirtualHost>

Notice how we will be using a DocumentRoot directives for the example.net. This will allow us to demonstrate setting up a simple redirect from the base address to the example.net iFolder Web Access.

Configure the Simias data directory

Pay attention to the example_net_simias10 entries. While the mod_mono variable names are arbitrary, every virtual host's value must be unique

  • The Simias data directory configuration is located in the /etc/simias/apache/example.net/simias_server.conf file. Below is a snippet of the file where the important changes are in bold:
Alias /simias10 "/usr/lib/simias/web"
AddMonoApplications example_net_simias10 "/simias10:/usr/lib/simias/web"
MonoSetEnv example_net_simias10 SimiasDataDir=/var/lib/example.net/simias
<Location /simias10 >
       MonoSetServerAlias example_net_simias10
       Order allow,deny
       Allow from all
       SetHandler mono
</Location>

Create Simias data directory

Create the example.net Simias data directory.

 mkdir -p /var/lib/example.net/simias

Configure the example.net virtual host's iFolder Web Access

We need to make sure that we have the example.net iFolder Web Access configuration pointing to the correct IP address. This will allow the example.net iFolder Web Access to successfully access the example.net iFolder web services. Also, pay attention to the example_net_ifolder entries. While the mod_mono variable names are arbitrary, every virtual host's value must be unique

  • To do this we need to modify the /etc/simias/apache/example.net/ifolder_webaccess.conf file. Below is a snippet of the file where the important changes are in bold:
 Alias /ifolder "/usr/lib/simias/webaccess"
 AddMonoApplications example_net_ifolder "/ifolder:/usr/lib/simias/webaccess"
 MonoSetEnv example_net_ifolder SimiasUrl=http://192.168.1.114
 <Location /ifolder >
        MonoSetServerAlias example_net_ifolder
        Order allow,deny
        Allow from all
        AddHandler mono asax aspx ascx asmx ashx
        DirectoryIndex Default.aspx index.html
</Location>

Configure the example.net virtual host's iFolder Web Administration

We need to make sure that we have the example.net iFolder Web Administration configuration pointing to the correct IP address. This will allow the example.net iFolder Web Administration to successfully access the example.net iFolder web services. Once again, pay attention to the example_net_admin entries. While the mod_mono variable names are arbitrary, every virtual host's value must be unique

  • To do this we need to modify the /etc/simias/apache/example.com/ifolder_admin.conf file. Below is a snippet of the file where the important changes are in bold:
Alias /admin "/usr/lib/simias/admin"
AddMonoApplications example_net_admin "/admin:/usr/lib/simias/admin"
MonoSetEnv example_net_admin SimiasUrl=http://192.168.1.114
<Location /admin >
       MonoSetServerAlias example_net_admin
       Order allow,deny
       Allow from all
       AddHandler mono asax aspx ascx asmx ashx
       DirectoryIndex Default.aspx index.html
</Location>

Copy the /etc/simias/bill contents to the example.net Simias data directory

Just like the example.com, we will want to manually copy the configuration over to the example.net Simias data directory

 cp -r /etc/simias/bill/* /var/lib/example.net/simias/

By manually copying these configuration files, this will allow us to make changes prior to the iFolder server reading the values into the data store. We will want to customize some values in the /var/lib/example.net/simias/Simias.config for our new example.net domain. Below is a snippet of the Simias.config with the modified values in bold:

<configuration>
  <section name="EnterpriseDomain">
    <setting name="ServerName" value="example.net iFolder Server" />
    <setting name="Description" value="example.net iFolder Enterprise Server" />
    <setting name="AdminName" value="example_net_admin" />
    <setting name="AdminPassword" value="example_net_simias" />
  </section>

Create example.net DirectoryRoot

For the example.net virtual host, we will create the DocumentRoot and create an index.html file that redirects requests from the virtual host directory root automatically to the example.net iFolder Web Access.

  • Create the DirectoryRoot
mkdir -p /var/lib/www/example.net
  • With your text editor of choice, create the /var/lib/www/example.net/index.html file with the following content
 <meta HTTP-EQUIV="REFRESH" content="0; url=http://192.168.1.114/ifolder">

NOTE Remember to change 192.168.1.114 to reflect your server's IP or DNS name.

Assign Apache ownership of Simias data directory

Ok, now we have all of the necessary files in place, lets give the Apache process ownership of the files.

SUSE Platforms

Use this command on SUSE platforms

 chown -R wwwrun:www /var/lib/example.net
 chown -R wwwrun:www /var/lib/www/example.net

Fedora and CentOS Platforms

Use this command on Fedora and CentOS platforms

 chown -R apache:apache /var/lib/example.net
 chown -R apache:apache /var/lib/www/example.net

Verifying that the example.net domain works

Ok, now we have all of the files in place, lets start Apache and test to see if things are working correctly by opening a browser and hitting the example.net iFolder web services directly. In a browser we will want to hit the following URL:

 http://192.168.1.114/simias10/DomainService.asmx

NOTE Remember to change 192.168.1.114 to the IP address you setup for your environment If things are working correctly you will be prompted to authenticate. At this point if you were using the example values shown in this howto, the username would be "example_net_admin" and the password would be "example_net_simias". If you are able to successfully login and see this page, this means the iFolder server is working correctly

Enlarge



Now lets test to make sure the the example.net Web Administration and Web Access components are working as well.

  • Using a browser, access the iFolder Web Access
 http://192.168.1.114/ifolder
 http://192.168.1.114/
  • Open a browser and access the iFolder Web Administration
http://192.168.1.114/admin

NOTE Remember to change 192.168.1.114 to the IP address you setup for your environment