Can you make changes as below and try again.

On 24 March 2010 13:34, Christophe Pettus <[email protected]> wrote:
> I'm having a very odd issue with named virtual hosts and mod_wsgi, and am
> wondering if I'm screwing up or if this is a known problem.
>
> In particular, we have three named virtual hosts, sharing a single IP, on a
> single machine.  The .conf file (sanitized) is attached below.
>
> In particular, the virtual host "a" (the first) is correctly served.
>  However, virtual hosts "b" and "c" both served from "b"'s django.wsgi,
> *regardless of the order of the VirtualHost directive sections*.
>
> I've tried serving direct pages with the WSGI-related directives commented
> out, and the vhosts are being distinguished by Apache correctly.
>
> RHEL 5.4, Apache/2.2.3, mod_wsgi 2.3

Upgrade mod_wsgi. Do not use such an old version. Shouldn't make a
difference with this, but that old version has other bugs in it that
can screw you up. So, use mod_wsgi 3.2 if you can.

For newer RedHat packages see:

  http://code.google.com/p/modwsgi/wiki/InstallationOnLinux

> Any thoughts as to why that might be?
>
> --
>
> NameVirtualHost *

Be specific and say:

  NameVirtualHost *:80

Ie., name port instead of wildcard on everything.

> <VirtualHost *>

Same here.

  <VirtualHost *:80>

>    ServerAdmin [email protected]
>    ServerName a.example.com
>    ServerAlias a.example.com
>
>    DocumentRoot /home/example/example
>
>    <Directory "/home/example/example">
>        Options -Indexes FollowSymLinks
>        AllowOverride None
>        Order allow,deny
>        Allow from all
>    </Directory>
>
>   WSGIDaemonProcess old processes=4 threads=32 display-name=%{GROUP}
>   WSGIProcessGroup old
>   WSGIScriptAlias / /home/example/example/apache/django.wsgi
>
>    <Location "/media">
>        SetHandler None
>    </Location>

You don't need this 'SetHandler None' stuff with mod_wsgi, only with mod_python.

For mod_wsgi just the act of setting up Alias directive, which you
haven't done anyway, would be enough for static files at that sub URL
to take precedence. Ie., when you do map static files, just add:

  Alias /media/ /some/path/

No need for SetHandler.

> </VirtualHost>
>
> <VirtualHost *>

Same here.

  <VirtualHost *:80>

>    ServerAdmin [email protected]
>    ServerName b.example2.com
>    ServerAlias b.example2.com
>
>    DocumentRoot /home/b/example
>
>    <Directory "/home/b/example">
>        Options -Indexes FollowSymLinks
>        AllowOverride None
>        Order allow,deny
>        Allow from all
>    </Directory>
>
>   WSGIDaemonProcess dev processes=4 threads=32 display-name=%{GROUP}
>   WSGIProcessGroup dev
>   WSGIScriptAlias / /home/b/example/apache/django.wsgi
>
>    <Location "/media">
>        SetHandler None
>    </Location>

Remove as above.

> </VirtualHost>
>
> <VirtualHost *>

Same here.

  <VirtualHost *:80>

>    ServerAdmin [email protected]
>    ServerName c.example2.com
>    ServerAlias c.example2.com
>
>    DocumentRoot /home/cpettus/example
>
>    <Directory "/home/cpettus/example">
>        Options -Indexes FollowSymLinks
>        AllowOverride None
>        Order allow,deny
>        Allow from all
>    </Directory>
>
>   WSGIDaemonProcess test processes=4 threads=32 display-name=%{GROUP}
>   WSGIProcessGroup test
>   WSGIScriptAlias / /home/cpettus/example/apache/django.wsgi
>
>    <Location "/media">
>        SetHandler None
>    </Location>

Remove as above.

> </VirtualHost>

Even if cant upgrade, which is recommended though, try being specific
about ports and will see if that makes a difference.

If that doesn't help, then install as WSGI script:

import cStringIO

def application(environ, start_response):
    headers = []
    headers.append(('Content-Type', 'text/plain'))
    write = start_response('200 OK', headers)

    input = environ['wsgi.input']
    output = cStringIO.StringIO()

    keys = environ.keys()
    keys.sort()
    for key in keys:
        print >> output, '%s: %s' % (key, repr(environ[key]))
    print >> output

    output.write(input.read(int(environ.get('CONTENT_LENGTH', '0'))))

    return [output.getvalue()]

Then post for each host what it displays so can see how each differs.

Graham

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/modwsgi?hl=en.

Reply via email to