Koozali.org: home of the SME Server

Obsolete Releases => SME Server 7.x => Topic started by: fixit on November 19, 2006, 03:11:21 AM

Title: Multiple Domains & i-bays
Post by: fixit on November 19, 2006, 03:11:21 AM
How do I get each i-bay to associate with a domain name

I have 3 Domains, domain1, the primary domain can view all i-bays, however if I load the other domains 2 & 3 they cannot view the other  i-bays.

How do I get each i-bay to associate with a domain name other than primary

Example

I have a /forums i-bay and a /downloads i-bay, I would like the other domains to view and load the i-bays when requested from the url

www.domain1.com
www.domain2.com/downloads
www.domain3.com/forums

I have created users and groups for these i-bays and it makes no difference, I have also looked for information on the forums and the manual and the information seems to relate to email users to different domains.

any help or reference material about domains and i-bay would be great, I have created i-bays for each domain.

Thanks, Russell
Title: Multiple Domains & i-bays
Post by: mmccarn on November 19, 2006, 05:06:20 AM
SME 7 allows you to map domains to i-bays in a one-to-one manner with the exception of the 'Primary' i-bay, which can 'see' all of the i-bays by adding '/ibayname' to the end of your primary url.

You map your 'virtual hosts' in the 'domains' panel in server-manager, making it easy to do this:
Leaving you with this list of valid URLs:
-or-[/list]
Don't create any virtual domains, but map all three domains to the same IP address in your external DNS.  Now all three domains pull up the same content:
-or-[/list]
Create everything as originally proposed, but setup your web content like this:downloads goes here: /home/e-smith/files/ibays/downloads/html/downloads
content for forums goes here: /home/e-smith/files/ibays/forums/html/forums[/list]Now, setup your domains like this:And these urls are all valid:
-or-[/list]
Learn enough about /etc/httpd/conf/httpd.conf to customize it as you wish, then learn enough about SME templating so your customizations work with SME, then write a How-to and post it back here...
Title: Re: Multiple Domains & i-bays
Post by: raem on November 19, 2006, 05:47:46 AM
fixit

> I have also looked for information on the forums and the manual

Try the chapter dealing with the Domains panel rather than the Pseudonyms panel !
Title: Multiple Domains & i-bays
Post by: fixit on November 19, 2006, 01:35:29 PM
I'm not sure if I am explaning myself correctly, or I'm missing something or maybe it could be the wording I'm using is incorrect but I will try again

I have read the chapters below from the manual http://smeserver.sourceforge.net/sme70/Manual?v=78k#h69-8
13.6. Domains Chapter 14. Information Bays (i-bays) 14.2. Accessing the i-bays & 14.3. Creating an i-bay

I have 3 domains setup & configured on my SME Server with a single static ip & each domain is configured to a ibay

www.domain1.com configured to primary i-bay
www.domain2.com configured to dom2 i-bay
www.domain3.com configured to dom3 i-bay

I have several i-bays for different purposes, some are used for general shares on the network and some are used for sharing information on the internet

I have a forums i-bay and also have a downloads i-bay, as well as a CRM i-bay, currently only the primary domain can view these i-bays in the url

www.domain1.com/forums

and

www.domain1.com/downloads

What I would like to do is have the forums i-bay used by domain2, so how do I setup the forums i-bay to showup when I load

www.domain2.com/forums

I do not want to configure a domain name to an i-bay, as this process is already done. What I want to do is associate an i-bay with a domain name

Example

I have an i-bay forums and I would like to view this i-bay with a virtual domain, such as; www.domain2.com/forums

any info would be greatly appreciated

Thanks Russell
Title: Multiple Domains & i-bays
Post by: mmccarn on November 19, 2006, 08:03:48 PM
[stream-of-consciousness]
Could you tell us the actual folder location to url mappings you're trying to implement?

You want *some* of your i-bays to be visible from within domains that are already mapped to other i-bays?

I'd look at /etc/httpd/conf/httpd.conf and copy the section for the 'sub-ibay' in the Primary <VirtualHost> to the desired mapped virtualhost.

One example subsection from my Primary virtual host definition:
Code: [Select]
<VirtualHost 0.0.0.0:80>
    ServerName ...
    ...
        # egroupware ibay (eGroupWare)

    ScriptAlias /egroupware/cgi-bin /home/e-smith/files/ibays/egroupware/cgi-bin
    Alias       /egroupware/files   /home/e-smith/files/ibays/egroupware/files
    Alias       /egroupware        /home/e-smith/files/ibays/egroupware/html
    ...
</VirtualHost>


Of course it's easy to copy this code to the desired VirtualHost definition, but I don't know how to template it so that SME won't un-define it for you the next time you make a change in server-manager, unless Apache lets you add another 'VirtualHost' section at the end of httpd.conf that modifies an earlier entry...

You could setup the domain, copy out all of the SME VirtualHost info to another file, add your customizations, delete the virtual domain, then use a custom-template to feed the entire VirtualHost entry back into httpd.conf -- but then you lose the email addresses, pseudonyms, etc...

You could setup the domain, copy out the SME VirtualHost info, then create completely custom templates for the entire VirtualHost subsection - overriding and nullifying the defaults.  I think this would require that you  copy 20IbayContent to /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/VirtualHosts and customize it produce the desired ibay mappings in the desired VirtualHost section...  

If you're ambitious you could customize 20IbayContent to look for a new key in domains ("Ibays", type "list" for example) and expand the standard Primary ibay mappings into that VirtualHost section -- then you can add and delete ibay content to virtualhosts by running db domains setprop domain2.com Ibays forums enabled download disabled(this is way, way, way beyond me, but might actually be useful in the Primary domain as well - to allow you to disable a given ibay mapping in the Primary...)

Or, looking at the 80VirtualHosts template fragment, it looks as though you can specify a different path for the httpd.conf templates for any given domain by setting the TemplatePath variable in the domains database...

Or, you can run db domains setprop domain2.com SystemPrimaryDomain yes which causes all of the ibay directives to be added to the 'domain2.com' virtualhost section of httpd.conf (but now you have two domains marked 'SystemPrimaryDomain', which may break something else...)  

Or, you could do it manually by adding something like this to the end of your customized 20IbayContent (just before the final "}" in the original version):
Code: [Select]
...
    if ($virtualHost eq 'domain2.com')
    {
      $OUT .= "  # manual info from custom 20IbayContent fragment\n\n";
      $OUT .= "    ScriptAlias /forums/cgi-bin /home/e-smith/files/ibays/forums/cgi-bin\n";
      $OUT .= "    Alias       /forums/files   /home/e-smith/files/ibays/forums/files\n";
      $OUT .= "    Alias       /forums         /home/e-smith/files/ibays/forums/html\n";
    }
Be sure to change 'domain2.com' to your non-primary domain name, and all instances of 'forums' to the desired ibay name...

[/stream-of-consciousness]
Title: Multiple Domains & i-bays
Post by: fixit on November 20, 2006, 01:03:21 AM
Thanks everyone for your replies, I did not expect this to be so complicated. I was looking for a simple command, thinking that would do the trick.

I like the idea of mmccarn, would this be possible to do, to set forums or the downloads i-bay so that the Primary domain & the Secondary domain can share these in the url


Quote
If you're ambitious you could customize 20IbayContent to look for a new key in domains ("Ibays", type "list" for example) and expand the standard Primary ibay mappings into that VirtualHost section -- then you can add and delete ibay content to virtualhosts by running db domains setprop domain2.com Ibays forums enabled download disabled(this is way, way, way beyond me, but might actually be useful in the Primary domain as well - to allow you to disable a given ibay mapping in the Primary...)

Or, you can run db domains setprop domain2.com SystemPrimaryDomain yes which causes all of the ibay directives to be added to the 'domain2.com' virtualhost section of httpd.conf (but now you have two domains marked 'SystemPrimaryDomain', which may break something else...)


Russell
Title: Final fix for this?
Post by: goodevans on February 19, 2007, 01:23:32 PM
Hi all

I had the same problem as this. We had to change the primary domain from .com to .ie because some email servers were being picky about reverse nslookups etc. This meant that all our ibays were inaccessible using the old .com addresses. Adapting one of mmcarn's proposals, here is my fix:

Set a new prop for the given domain:
Code: [Select]
/sbin/e-smith/db domains setprop domain2.com NonSystemPrimaryDomain yes

Now create a new copy of 20ibayContent in the custom templates area:
Code: [Select]
mkdir /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/VirtualHosts
cd /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/VirtualHosts/
cp /etc/e-smith/templates/etc/httpd/conf/httpd.conf/VirtualHosts/20IbayContent ./


Using your favourite text editor (mine is vi) change this line:
Code: [Select]
   if (($domains->get_prop($virtualHost, 'SystemPrimaryDomain') || 'no')
         eq 'yes')


to this:
Code: [Select]
   if (($domains->get_prop($virtualHost, 'SystemPrimaryDomain') || 'no')
         eq 'yes' || ($domains->get_prop($virtualHost, 'NonSystemPrimaryDomain') || 'no') eq 'yes')


Then expand the template and restart:
Code: [Select]
/sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf
/etc/init.d/httpd-e-smith restart
/etc/init.d/httpd-admin restart


And that should be it. The above lines are confirmed to work on sme7. I don't know if setting SystemPrimaryDomain against a second domain would have broken anything, but this works in the same way and definitely won't affect anything other than adding the ibays to the domain.