在 apache 配置中使用 WSGIApplicationGroup %{GLOBAL} 的问题 [英] problem using WSGIApplicationGroup %{GLOBAL} in apache configuration

查看:34
本文介绍了在 apache 配置中使用 WSGIApplicationGroup %{GLOBAL} 的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 apache 和 mod_wsgi 中使用 django当我在 apache 配置文件 (.conf) 中使用 WSGIApplicationGroup %{GLOBAL} 时遇到问题.我不知道我是否正确使用了这个指令,或者我需要以另一种方式使用它,问题是我需要添加这个指令来解决这个故障单中描述的 xapian 问题(http://trac.xapian.org/ticket/185)之后搜索开始工作,但我所有的网站内容都混在一起了up,意味着 site1 内容出现在 site2 上.当我删除 WSGIApplicationGroup %{GLOBAL} 时,站点再次正确呈现,但搜索停止工作.

im using django with apache and mod_wsgi i am facing a problem when i use WSGIApplicationGroup %{GLOBAL} in apache configuration file (.conf) . i dont know if i am using this directive correctly or i need to use it in another way , the problem is that i needed to add this directive to fix a problem for xapian as described in this ticket (http://trac.xapian.org/ticket/185) after that the search started to work but all my sites contents got mixed up, meaning site1 content appears on site2.when i removed WSGIApplicationGroup %{GLOBAL} , sites are rendering properly again but search stopped working.

这是我的 .conf 文件内容:

here is my .conf file contents:

NameVirtualHost my_ip_address:80
WSGIApplicationGroup %{GLOBAL}
<VirtualHost my_ip_address:80>
ServerName www.site1.com
ServerAlias site1

WSGIScriptAlias / "/home/sa/www/site1/apache/django.wsgi"
<Directory "/home/sa/www/site1/apache">
    Allow from all
</Directory>

Alias /site_media/ "/home/sa/www/site1/media/"
<Directory "/home/sa/www/site1/media/">
    Order allow,deny
    Options Indexes FollowSymLinks
    Allow from all
    IndexOptions FancyIndexing
</Directory>


</VirtualHost>

WSGIApplicationGroup %{GLOBAL}

<VirtualHost my_ip_address:80>
ServerName www.site2.com
ServerAlias site2

WSGIScriptAlias / "/home/sa/www/site2/apache/django.wsgi"
<Directory "/home/sa/www/site2/apache">
    Allow from all
</Directory>

Alias /site_media/ "/home/sa/www/site2/media/"
<Directory "/home/sa/www/site2/media/">
    Order allow,deny
    Options Indexes FollowSymLinks
    Allow from all
    IndexOptions FancyIndexing
</Directory>

Alias /media/ "/usr/local/lib/python2.6/dist-packages/django/contrib/admin/media/"
<Directory "/usr/local/lib/python2.6/dist-packages/django/contrib/admin/media/">
    Order allow,deny
    Options Indexes FollowSymLinks
    Allow from all
    IndexOptions FancyIndexing
</Directory>

</VirtualHost>



WSGIApplicationGroup %{GLOBAL}

< VirtualHost my_ip_address:80 >
ServerName www.site3.com
ServerAlias site3

WSGIScriptAlias / "/home/sa/www/site3/apache/django.wsgi"
<Directory "/home/sa/www/site3/apache">
    Allow from all
</Directory>

Alias /site_media/ "/home/sa/www/site3/media/"
<Directory "/home/sa/www/site3/media/">
    Order allow,deny
    Options Indexes FollowSymLinks
    Allow from all
    IndexOptions FancyIndexing
</Directory>

Alias /media/ "/usr/local/lib/python2.6/dist-packages/django/contrib/admin/media/"
<Directory "/usr/local/lib/python2.6/dist-packages/django/contrib/admin/media/">
    Order allow,deny
    Options Indexes FollowSymLinks
    Allow from all
    IndexOptions FancyIndexing
</Directory>

</VirtualHost>


WSGIApplicationGroup %{GLOBAL}

<VirtualHost my_ip_address:80>

ServerName www.site4.com
ServerAlias site4

WSGIScriptAlias / "/home/sa/www/site4/apache/django.wsgi"
<Directory "/home/sa/www/site4/apache"> 
    Allow from all 
</Directory>

Alias /site_media/ "/home/sa/www/site4/media/"
<Directory "/home/sa/www/site4/media/">
    Order allow,deny
    Options Indexes FollowSymLinks
    Allow from all
    IndexOptions FancyIndexing
</Directory>

Alias /media/ "/usr/local/lib/python2.6/dist-packages/django/contrib/admin/media/"
<Directory "/usr/local/lib/python2.6/dist-packages/django/contrib/admin/media/">
    Order allow,deny
    Options Indexes FollowSymLinks
    Allow from all
    IndexOptions FancyIndexing
</Directory>

</VirtualHost>


WSGIApplicationGroup %{GLOBAL}

<VirtualHost my_ip_address:80>
ServerName www.site5.com
ServerAlias site5

WSGIScriptAlias / "/home/sa/www/site5/apache/django.wsgi"
<Directory "/home/sa/www/site5/apache">
    Allow from all
</Directory>

Alias /site_media/ "/home/sa/www/site5/media/"
<Directory "/home/sa/www/site5/media/">
    Order allow,deny
    Options Indexes FollowSymLinks
    Allow from all
    IndexOptions FancyIndexing
</Directory>

Alias /media/ "/usr/local/lib/python2.6/dist-packages/django/contrib/admin/media/"
<Directory "/usr/local/lib/python2.6/dist-packages/django/contrib/admin/media/">
    Order allow,deny
    Options Indexes FollowSymLinks
    Allow from all
    IndexOptions FancyIndexing
</Directory>

</VirtualHost>

有没有人遇到过这个问题任何建议

has anybody faced this issue any suggestions

谢谢

推荐答案

Django 的实现可以防止多个 Django 实例在同一个解释器(应用程序组)中运行.因此,如果在同一个 Apache 服务器上运行多个 Django 站点并且必须将 WSGIApplicationGroup 设置为 %{GLOBAL},那么您必须使用守护进程模式并将每个 Django 站点委托给一个单独的守护进程组.无论如何,守护进程模式是首选.

Django's implementation prevents multiple Django instances running in same interpreter (application group). Thus if running multiple Django sites on same Apache server and must set WSGIApplicationGroup to %{GLOBAL}, then you MUST use daemon mode and delegate each Django site to a separate daemon process group. Daemon mode is preferred anyway.

确保您阅读:

http://code.google.com/p/modwsgi/wiki/QuickConfigurationGuidehttp://code.google.com/p/modwsgi/wiki/ReloadingSourceCode

后面部分解释了为什么守护进程模式在使代码重新加载更容易方面是好的.

The latter explaining part why daemon mode is good as far as making code reloading easier.

这篇关于在 apache 配置中使用 WSGIApplicationGroup %{GLOBAL} 的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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