如何维护多个Django项目作为基于端口的Cherokee虚拟主机?

发布于 2024-10-10 03:06:25 字数 451 浏览 5 评论 0原文

是否可以在一个IP地址上维护多个Django(实际上是FastCGI/SCGI)项目,并通过端口来区分它们?

我真的很喜欢切诺基。它的管理界面和它带来的易于定制性真是太棒了。因此,我对缺乏(至少以明显、明确的方式)基于端口的虚拟主机感到有点难过。

请在回答时记住:

  1. 按端口匹配虚拟服务器 - 我确实读过。

  2. 不要建议其他网络服务器 - 我知道我可以将它们用于此目的,但我正在努力更好地学习 Cherokee。

非常感谢。

Is it possible to maintain multiple Django (actually, FastCGI/SCGI) projects on one IP address, and distinguish them by port?

I really like Cherokee. Its admin interface and ease of customization, which it brings, are just awesome. So, I feel kinda sad about the lack (at least in an obvious, explicit way) of port-based virtual hosts.

Please, keep in mind while answering:

  1. Match virtual servers by port -- I did read that.

  2. Don't advise other web servers -- I know that I can use them for this purpose, but I'm trying to learn Cherokee better.

Many thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

几度春秋 2024-10-17 03:06:25

是的,这是可能的。

首先,您需要设置 Cherokee 以侦听所需的端口:

在常规 -> 下“要侦听的端口”添加端口并将 IP 字段留空(对于所有 IP)。

然后,为您托管的每个应用程序创建一个虚拟主机。

对于每个虚拟主机,确保所有行为规则都有一个“AND”规则(在“规则”选项卡下),并将“传入端口/IP”设置为您之前设置的所需端口。

然后,仅当传入端口匹配时才会调用每个规则的处理程序,正如您所希望的那样。

在我自己的配置上测试这一点时,我在创建 AND 规则时遇到了一些麻烦(选择“传入端口/IP”规则类型后,配置处于无效状态,直到实际选择端口为止),因此请务必首先备份您的配置文件以防万一(我的位于 /etc/cherokee/cherokee.conf)!

Yes, this is possible.

First, you need to set up Cherokee to listen to the desired ports:

Under General -> "Ports to Listen" add the port and leave the IP field blank (for all IPs).

Then, for each application you're hosting, create a virtual host.

For each of the virtual hosts, make sure that all the behaviour rules have an "AND" rule (under the Rules tab) with the "Incoming Port/IP" set to the desired port that you previously set up.

Then the handlers for each rule will only be invoked if the incoming port is matched, exactly as you want.

While testing this out on my own config I ran into some trouble creating an AND rule (upon selection of the "Incoming Port/IP" rule type the config was left in an invalid state until a port was actually chosen), so be sure to backup your configuration file first just in case (mine's at /etc/cherokee/cherokee.conf)!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文