使用一个 drupal 为多个站点提供服务(不使用多站点)
我正在寻求有关如何使用一个 Drupal 实例(使用 Pressflow 6.x)最好地为多个站点提供服务的专家建议。让我们考虑一下需要此功能的公司称为“ABC Group of Companies”,它有 3 个姐妹问题。因此,总共将有四个站点:
以下是最有趣的是:
- 用户将在所有人之间共享 网站
- 每个网站“主要”都会托管自己的内容(例如主页上的欢迎文本或菜单项 - 每个网站都不同)。
- 有些内容将显示在所有网站中(例如,公司范围内的通知)。 ...或员工目录)
- 每个站点的主题都会不同
现在,我正在考虑使用 DNS 条目,以便每个域都指向相同的 Drupal 安装,并且当 Drupal 启动时,我想嗅探 $ _SERVER 数组以了解哪个站点正在被访问。然后,我想相应地加载主题,显示特定于该网站的内容,并显示与所有网站共享的内容。
为了实现这一点,到目前为止,我已经创建了一个名为“站点”的节点类型,并为每个站点创建了四个内容。然后,对于每个其他内容类型(例如,页面),我放置了一个对具有多个值的“站点”内容类型的节点引用,以便在创建新内容时,管理员可以指定该内容将在哪个站点中显示。然而,在那之后我就陷入困境了。
我试图理解上下文、空间、PURL - 但还没有完全弄清楚它们。您认为处理这种情况的最佳方法是什么?
I am looking for expert advice on how to best serve multiple sites with one Drupal instance (using Pressflow 6.x). Let's consider the company needing this is called "ABC Group of Companies" and it has 3 sister concerns. So, altogether there will be four sites:
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. 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. 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. What do you think is the best approach to handle this scenario ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您建议的方式当然是您可以做到的方式,但是您是否考虑过域访问?我过去曾使用过它,发现它非常有用。还有相当多的与其配合使用的模块集合。不同的主题、哪些节点应该出现在哪些站点上以及共享用户的选项都是它所具有的功能。
希望这有帮助!
http://drupal.org/project/domain
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
首先,我强烈第二个建议使用域访问模块 为此(+1)。它为您的场景提供了广泛的支持/功能,并且已经涵盖了您需要自行解决的大部分困难部分。
其次,如果您坚持自己尝试这样做,我可以向您保证这是可能的,因为我们最近做了一些非常类似的事情(一些特殊要求排除了域访问),但这是一个大量的工作,特别是当贡献模块提供的功能不太适合我们的“不寻常”场景时。
考虑到您必须涵盖的众多特殊情况,很难指出一个总体方向(除了建议使用 域访问模块;)但一个要点是查看<代码>custom_url_rewrite_inbound()/
custom_url_rewrite_outbound()
功能组合。这些将允许您对传入请求以及为输出生成的 URL 进行相当低级的 URL 操作,如果您想从同一实例提供多个域,则需要执行这两项操作。我是否提到过,在尝试自己构建此模块之前,您应该先查看域访问模块?
First up, I strongly second hookds suggestion of using Domain Access Module for this (+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. 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.Did I mention that you should check out Domain Access Module before you try to build this yourself?
听起来这些网站之间几乎不会共享任何内容。您想要在所有站点上进行一次登录吗?
请记住,Domain Access 使用 1 个共享数据库。
您也可以只进行常规的多站点安装,并共享某些表。
我对 Domain Access 竖起两个大拇指,但只要确保您确实需要它的实际功能即可。
另外,我会研究 Feeds.module。您可以从任何地方(尤其是另一个 drupal 站点)提取内容,它会直接导入内容并自动从中创建节点和字段。
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.
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.
Also, I would look into the 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.