一个虚拟主机上的多个应用程序的mod_wsgi引导到错误的应用 [英] Multiple mod_wsgi apps on one virtual host directing to wrong app

查看:173
本文介绍了一个虚拟主机上的多个应用程序的mod_wsgi引导到错误的应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图让两个(或更多)Django应用程序在子目录中的同一个域下成立的,例如:

I'm trying to get two (or more) Django applications set up at subdirectories under the same domain, e.g.:

http://example.com/site1/
http://example.com/site2/

我知道,这通常通过设置工作正常,一个Apache虚拟主机是这样的:

I know that normally this works fine by setting up an apache virtualhost like this:

<VirtualHost *:80>
    ...
    WSGIScriptAlias /site1 /path/to/site1.wsgi
    WSGIScriptAlias /site2 /path/to/site2.wsgi
</VirtualHost>

现在,我已经验证了每个网站单独工作。但是,当我尝试运行两侧并排,阿帕奇送我去工作进程加载的第一个网站为准。例如:

Now, I've verified that each site works individually. But when I try to run both side-by-side, apache sends me to whichever site the worker process loaded first. Example:


  1. 重新启动Apache配置为提供6个线程

  2. 加载example.com/site1/,得到正确的页面

  3. 加载example.com/site2/,得到正确的页面

  4. 重复2和3 2次以上。

  5. 刷新example.com/site1/反复,看着它从网站周期网站。

实际上,对于工作进程的任何给定数目,它循环通过它们的总数量将请求发送到它击中任何一个第一不管WSGIScriptAlias​​指令。不管我做什么(设置WSGIProcessGroup,守护进程模式与嵌入模式,或指令),它会继续出现此行为。

Effectively, for any given number of worker processes, it cycles through the total number of them sending the request to whichever one it hit first regardless of the WSGIScriptAlias directive. No matter what I do (setting WSGIProcessGroup, daemon mode vs. embedded mode, or directives) it continues to exhibit this behavior.

如果任何人都可以指出我做错了什么在这里,这将是惊人的!

If anyone can point out what I'm doing wrong here, that would be phenomenal!

推荐答案

我已经在一个运行的Apache安装多个应用程序WSGI,发现最容易做的事情就是有多个进程groups--为每个的应用程序。

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.

一个缺点,其实与试图让一个单独的进程同时运行(或更多)的应用程序,是这可能会使用多一点常驻内存比你能逃脱,否则。但让他们pretty很好的分离,避免麻烦。这可能不是你一个问题(这不是对我来说)。

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>

这篇关于一个虚拟主机上的多个应用程序的mod_wsgi引导到错误的应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆