且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

一台虚拟主机上的多个 mod_wsgi 应用指向错误的应用

更新时间:2023-11-22 18:06:52

我在一个 Apache 安装上运行了多个 WSGI 应用程序,发现最简单的方法就是拥有多个进程组——每个进程组一个应用程序.

I've had multiple WSGI apps running on a single Apache install, and found that the easiest thing to do is just have multiple process groups-- one for each of the apps.

与实际尝试让单个进程运行两个(或多个)应用程序相比,一个缺点是这可能会使用比其他方式更多的常驻内存.但它使它们很好地分开并避免了麻烦.这可能不是你的问题(这不是我的问题).

One downside, versus actually trying to get a single process to run both (or more) apps, is that this might use a little more resident memory than you could get away with otherwise. But it keeps them pretty well separated and avoids hassle. And that might not be a concern for you (it wasn't for me).

(也可能没那么糟糕,他们可能能够共享很多文本页面?这只是闲置的猜测;我还没有以任何方式验证这一点,因为我的设置根本没有内存不足)

(It might not be that bad either, they might be able to share a lot of text pages? That's just idle speculation; I haven't verified this in any way, as my setup was not at all memory-starved)

这里是我的 httpd.conf 的一些片段,大概是:

Here's some snippets of my httpd.conf, approximately:

WSGIDaemonProcess khdx_wsgi user=galdosd group=galdosd maximum-requests=10000
WSGIScriptAlias /khdx /home/galdosd/khdxweb/rel/khdx/apache/django.wsgi
<Location /khdx>
WSGIProcessGroup khdx_wsgi
</Location>

WSGIDaemonProcess sauron_wsgi user=galdosd group=galdosd maximum-requests=10000
WSGIScriptAlias /sauron /home/galdosd/finalsauronweb/django-root/apache/django.wsgi
<Location /sauron>
WSGIProcessGroup sauron_wsgi
</Location>