There is likely something missing as far as enabling of name based
virtual hosts, or hostnames are not matching ServerName.

When there are VirtualHost's defined, if Apache can't map the host
name properly against the VirtualHost, then Apache will send the
request to the first VirtualHost definition it found. If that happened
to be the one for app_a, that would explain why everything goes to it.

First thing to check is that you have:

  NameVirtualHost *:80

directive present and that it isn't commented out.

Then ensure that ServerName directive does have value the same as
actual host name using in the URL.

One other thing you can do is add in a default VirtualHost as very
first one, which from memory is defined as:

<VirtualHost __default__:80>
Deny from all
</VirtualHost>

With that in place, if named virtual host lookup is failing, will go
to that and you will get a forbidden error, rather than it going to
wrong virtual host.

Graham

On 7 February 2012 11:56, Chris Cuilla <[email protected]> wrote:
> I've been struggling to figure out the following problem and am hoping
> someone else has seen this.
>
> I have a server running Apache 2 w/mod_wsgi. I've setup multiple,
> different Django apps. Each has its own virtual host configuration
> (see below).
>
> This is on a local test server and my client machines have /etc/hosts
> configured to point both app_a and app_b hostnames to the same
> machine.
>
> The problem I have is that Apache is only serving app_a regardless of
> whether I go to app_a or app_b in my browser.
>
> Has anyone seen anything like this?
>
> P.S. When configured as plain, vanilla virtual hosts (i.e., no
> mod_wsgi) the virtual hosting works just fine.
>
>
> <VirtualHost *:80>
>    ServerName app_a
>
>    <Directory /home/app_a/public_html/app_a/static>
>    Order deny,allow
>    Allow from all
>    </Directory>
>
>    <Directory /home/app_a/public_html/app_a/media>
>    Order deny,allow
>    Allow from all
>    </Directory>
>
>    <Directory /home/app_a/public_html/app_a>
>    Order deny,allow
>    Allow from all
>    </Directory>
>
>    LogLevel warn
>    ErrorLog  /home/app_a/public_html/app_a/logs/apache_error.log
>    CustomLog /home/app_a/public_html/app_a/logs/apache_access.log
> combined
>
>    WSGIDaemonProcess app_a user=www-data group=www-data threads=20
> processes=2 display-name=app_a
>    WSGIProcessGroup app_a
>
>    WSGIScriptAlias / /home/app_a/public_html/app_a/app_a/app.wsgi
> </VirtualHost>
>
> <VirtualHost *:80>
>    ServerName app_b
>
>    <Directory /home/app_b/public_html/app_b/static>
>    Order deny,allow
>    Allow from all
>    </Directory>
>
>    <Directory /home/app_b/public_html/app_b/media>
>    Order deny,allow
>    Allow from all
>    </Directory>
>
>    <Directory /home/app_b/public_html/app_b>
>    Order deny,allow
>    Allow from all
>    </Directory>
>
>    LogLevel warn
>    ErrorLog  /home/app_b/public_html/app_b/logs/apache_error.log
>    CustomLog /home/app_b/public_html/app_b/logs/apache_access.log
> combined
>
>    WSGIDaemonProcess app_b user=www-data group=www-data threads=20
> processes=2 display-name=app_b
>    WSGIProcessGroup app_b
>
>    WSGIScriptAlias / /home/app_b/public_html/app_b/app_b/app.wsgi
> </VirtualHost>
>
> --
> 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.
>

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