开发者

How to maintain multiple Django projects as port-based Cherokee virtual hosts?

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.


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)!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜