简体   繁体   English

用一个drupal服务多个站点(不使用多站点)

[英]Serving multiple site with one drupal (not using multi site)

I am looking for expert advice on how to best serve multiple sites with one Drupal instance (using Pressflow 6.x). 我正在寻找有关如何使用一个Drupal实例最好地服务多个站点的专家建议(使用Pressflow 6.x)。 Let's consider the company needing this is called "ABC Group of Companies" and it has 3 sister concerns. 让我们考虑一下这个被称为“ABC集团公司”的公司,它有3个姐妹关注点。 So, altogether there will be four sites: 所以,总共会有四个站点:

  1. www.abcgroup.com www.abcgroup.com
  2. www.company-a.com www.company-a.com
  3. www.company-b.com www.company-b.com
  4. www.company-c.com www.company-c.com

Here are the things that are most interesting: 以下是最有趣的事情:

  • The users will be shared among all the sites 用户将在所有站点之间共享
  • Each site will "mostly" host their own content (say the welcome text on home page, or menu items - different for each site) 每个站点将“主要”托管他们自己的内容(比如主页上的欢迎文本或菜单项 - 每个站点不同)
  • Some contents, will be shown in all of the sites (say, a company-wide notice....or an employee directory) 一些内容将显示在所有站点中(例如,公司范围的通知....或员工目录)
  • The theme for each site will be different 每个网站的主题都不同

Now, I am thinking of having DNS entry so each of the domain point to the same Drupal installation and when Drupal gets bootstrapped, I would like to sniff into the $_SERVER array to know which site is being hit. 现在,我正在考虑使用DNS输入,因此每个域都指向相同的Drupal安装,当Drupal被引导时,我想嗅探$ _SERVER数组以了解哪个站点被命中。 I'd then like to load the theme accordingly, show the contents specific to that site, and also show the contents that are shared with all the sites. 然后,我想相应地加载主题,显示特定于该网站的内容,并显示与所有网站共享的内容。

To make this happen, so far I have created a node type called "Site" and have created four contents for each of the sites. 为了实现这一点,到目前为止,我创建了一个名为“Site”的节点类型,并为每个站点创建了四个内容。 Then for each other content type (say, Page) I have put a node reference to the "Site" content type with multiple value so when creating a new content, the administrator can specify in which site that content will be showed. 然后,对于每个其他内容类型(例如,页面),我已将节点引用放入具有多个值的“站点”内容类型,因此在创建新内容时,管理员可以指定将在哪个站点显示内容。 However, after that I am stuck. 然而,在那之后我被卡住了。

I have tried to understand Contexts, Spaces, PURL - but haven't figured them out fully yet and I believe I could use the community power to help me out. 我试图理解上下文,空间,PURL - 但还没有完全理解它们,我相信我可以利用社区力量来帮助我。 What do you think is the best approach to handle this scenario ? 您认为处理这种情况的最佳方法是什么?

It'd be greatly helpful if anybody can suggest a direction. 如果有人能提出方向,那将会非常有帮助。

Regards, 问候,

Emran 埃姆兰

The way you are suggesting is certainly a way that you could do it, but have you considered domain access? 您建议的方式当然是您可以这样做的方式,但您是否考虑过域名访问? I have used it in the past and found it to be very useful. 我过去曾经使用它,发现它非常有用。 there is also quite a large collection of modules which work with it. 还有相当多的模块集合可以使用它。 Different themes, Options as to which nodes should appear on which sites and shared users are all features that it has. 不同的主题,关于哪些节点应出现在哪些站点和共享用户上的选项都是它具有的所有功能。

Hope this helps! 希望这可以帮助!

http://drupal.org/project/domain http://drupal.org/project/domain

First up , I strongly second hookds suggestion of using Domain Access Module for this (+1). 首先 ,我强烈建议第二次使用域访问模块 (+1)。 It has extensive support/features for your scenario and already covers most of the hard parts you'd need to solve yourself otherwise. 它为您的场景提供了广泛的支持/功能,并且已经涵盖了您自己需要解决的大部分难题。

Second, if you insist on trying to do this yourself, I can assure you that it is possible, as we have done something pretty similar recently (some special requirements ruled out domain access), but it was a lot of work, especially when functionality provided by contributed modules would not fit well into our 'unusual' scenario. 其次, 如果你坚持尝试自己做这件事,我可以向你保证这是可能的,因为我们最近做了一些非常相似的事情(一些特殊要求排除了域访问权限),但这是很多工作,特别是当功能时由贡献的模块提供的内容不适合我们的“不寻常”场景。

Given the multitude of special cases you'd have to cover, it is hard to point out a general direction (apart from suggesting to use Domain Access Module ;) but one major point would be to check out the custom_url_rewrite_inbound() / custom_url_rewrite_outbound() function combo. 鉴于您必须涵盖的大量特殊情况,很难指出一个总体方向(除了建议使用域访问模块 ;)但一个主要观点是检查custom_url_rewrite_inbound() / custom_url_rewrite_outbound()功能组合。 These will allow you to do pretty low level URL manipulations for incoming requests, as well as for URLs generated for output, both of which you'll need to do if you you want to serve multiple domains from the same instance. 这些将允许您对传入请求以及为输出生成的URL执行相当低级别的URL操作,如果要从同一实例提供多个域,则需要执行这两种操作。

Did I mention that you should check out Domain Access Module before you try to build this yourself? 在您尝试自己构建之前,我是否提到您应该检查域访问模块

It sounds like there will be virtually no content shared between these sites. 听起来这些网站之间几乎没有内容共享。 Will you be wanting a single login across all sites? 您是否希望在所有网站上进行一次登录? Remember, Domain Access uses 1 shared database. 请记住,Domain Access使用1个共享数据库。 You could also just do a regular multi-site install, and share certain tables. 您也可以只进行常规的多站点安装,并共享某些表。

I give Domain Access two thumbs up, but just make sure you really need what it actually does. 我给了Domain Access两个大拇指,但只是确保你真的需要它实际上做的事情。

Also, I would look into the Feeds.module. 另外,我会查看Feeds.module。 You can pull content from anywhere (especially another drupal site) and it imports it directly and creates nodes and fields automatically from it. 您可以从任何地方(尤其是另一个drupal站点)提取内容,然后直接导入内容并自动创建节点和字段。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM