0

I have gotten virtual hosts to work, but somehow this setup of mine is behaving strangely.

NameVirtualHost *

<VirtualHost *>
 ServerAdmin webmaster@localhost
 ServerName x.com

    WSGIPassAuthorization On
    WSGIScriptAlias / /var/x/production/x.wsgi

 ErrorLog /var/log/apache2/error.log

 LogLevel warn

 CustomLog /var/log/apache2/access.log combined
 ServerSignature On

</VirtualHost>

<VirtualHost *>
 ServerAdmin webmaster@localhost
 ServerName staging.x.com

    WSGIPassAuthorization On
    WSGIScriptAlias / /var/x/testing/x.wsgi

 ErrorLog /var/log/apache2/error.log

 LogLevel warn

 CustomLog /var/log/apache2/access.log combined
 ServerSignature On

</VirtualHost>

This is the 'default' file in /etc/apache2/sites-available on my server.

I have two .wsgi files pointing to two copies of the same site, with changed settings files (mainly the database is changed from production to staging).

Somehow this setup doesn't work, though. When x.com is on top, both x.com and staging.x.com use the same database. When I reverse the order, both domains point at the staging django project.

I'm pretty sure that this is not a bug in mod_wsgi, but maybe I'm using WSGIScriptAlias incorrectly, maybe I don't use apache's ServerName correctly.

Thanks for checking this out, I'm stumped!

EDIT: Here is the output of apache2 -S

VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:*                    is a NameVirtualHost
         default server x.com (/etc/apache2/sites-enabled/000-default:3)
         port * namevhost x.com (/etc/apache2/sites-enabled/000-default:3)
         port * namevhost staging.x.com (/etc/apache2/sites-enabled/000-default:19)
Syntax OK

Does that help? Sorry, very noob to the serverfault side of things. (Usually doing stackoverflow type work.)

0

I usually use:

NameVirtualHost *:80

or

NameVirtualHost 0.0.0.0:80

VirtualHost 0.0.0.0:80

You have no ServerAlias directives, so, can you post the results of:

apache2 -S

or

httpd -S

depending on your distribution

  • thanks, added the output of apache2 -S. Does it look good? – rdrey Sep 12 '10 at 20:34
  • do i need to listen on two separate ports and set up separate proxy rules in my nginx frontend? – rdrey Sep 12 '10 at 20:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.