You are hereMultiple VirtualHost setting for Apache mod_wsgi requires ordering of WSGIScriptAlias before ServerName

Multiple VirtualHost setting for Apache mod_wsgi requires ordering of WSGIScriptAlias before ServerName


By meledictas - Posted on 17 November 2008

A lot of mod_wsgi configuration tutorial configure the single VirtualHost as below (from mod_wigs wiki),

<VirtualHost *:80>

    ServerName www.example.com
    ServerAlias example.com
    ServerAdmin webmaster@example.com

    DocumentRoot /usr/local/www/documents

    <Directory /usr/local/www/documents>
    Order allow,deny
    Allow from all
    </Directory>

    WSGIScriptAlias /myapp /usr/local/www/wsgi-scripts/myapp.wsgi

    <Directory /usr/local/www/wsgi-scripts>
    Order allow,deny
    Allow from all
    </Directory>

</VirtualHost>

I spent around one hour try to configure multiple VirtualHost on webfaction. I did exactly but the request always be routed to the first VirtualHost setting.

The solution

I reordered the settings by putting the WSGIScriptAlias before ServerName and it works fine. The question is, is that required or I did something wrong?