You cannot have multiple VirtualHost definitions with same ServerName
and same listener port. The first will be used and the latter ignored.

Only thing you could do is put snippets in separate files and then use
Include directive to include them both within the same VirtualHost.

You would have to be careful with order in doing this as directives
can be order dependent to ensure precedence.

For example:

  WSGIScriptAlias / /some/path/app.wsgi
  WSGIScriptAlias /suburl /other/path/app.wsgi

is wrong order and / would always take precedence. More deeply nested
sub URLs needs to be first.

So watch out for case of mixing root URL and sub URLs.

Graham


On 29 August 2012 01:51, Danny <[email protected]> wrote:
> Howdy,
>
> I'm an absolute newbie to mod_wsgi configuration. I'm trying to run two
> sites as subdirectories under localhost, e.g.
> localhost/test
> localhost/djangotest
>
> I want the two subdirectories to have their own daemon process. The
> following apache config works just fine:
>
> <VirtualHost *:80>
>
>     ServerName localhost
>
>     WSGIDaemonProcess test_wsgi display-name=%{GROUP}
>     WSGIScriptAlias /test /opt/www/test/wsgi/test.wsgi
>     <Location /test>
>     WSGIProcessGroup test_wsgi
>     </Location>
>
>     <Directory /opt/www/test/wsgi>
>     Order allow,deny
>     Allow from all
>     </Directory>
>
>     WSGIDaemonProcess djangotest_wsgi display-name=%{GROUP}
>     WSGIScriptAlias /djangotest /opt/www/djangotest/djangotest/wsgi.py
>     <Location /djangotest>
>     WSGIProcessGroup djangotest_wsgi
>     </Location>
>
>     <Directory /opt/www/djangotest/djangotest>
>     Order allow,deny
>     Allow from all
>     </Directory>
>
> </VirtualHost>
>
> The problem is that I want a modular config setup. If I split this into two
> separate config files. It breaks:
> test.conf:
>
> <VirtualHost *:80>
>
>     ServerName localhost
>
>     WSGIDaemonProcess test_wsgi display-name=%{GROUP}
>     WSGIScriptAlias /test /opt/www/test/wsgi/test.wsgi
>     <Location /test>
>     WSGIProcessGroup test_wsgi
>     </Location>
>
>     <Directory /opt/www/test/wsgi>
>     Order allow,deny
>     Allow from all
>     </Directory>
>
> </VirtualHost>
>
> and djangotest.conf
>
> <VirtualHost *:80>
>
>     ServerName localhost
>
>     WSGIDaemonProcess djangotest_wsgi display-name=%{GROUP}
>     WSGIScriptAlias /djangotest /opt/www/djangotest/djangotest/wsgi.py
>     <Location /djangotest>
>     WSGIProcessGroup djangotest_wsgi
>     </Location>
>
>     <Directory /opt/www/djangotest/djangotest>
>     Order allow,deny
>     Allow from all
>     </Directory>
>
> </VirtualHost>
>
> Here is what httpd sees as the virtualhost config:
>
> [root@badohat ~]# /usr/sbin/httpd -SVirtualHost configuration:
> wildcard NameVirtualHosts and _default_ servers:
> *:80                   is a NameVirtualHost
>          default server localhost
> (/etc/httpd/sites-enabled/djangotest.conf:1)
>          port 80 namevhost localhost
> (/etc/httpd/sites-enabled/djangotest.conf:1)
>          port 80 namevhost localhost (/etc/httpd/sites-enabled/test.conf:1)
> Syntax OK
>
> In particular djangotest is the default server and /test is processed under
> that server and fails:
>
> [Tue Aug 28 09:32:54 2012] [error] [client 127.0.0.1] File does not exist:
> /var/www/html/test
>
> I have been reading the archives and haven't been able to figure out how to
> split the config file. I'm sure the problem is related to the multiple
> VirtualHost with the same ServerName, but I'm too much of a newbie to figure
> out a workaround. Any ideas would be appreciated.
>
> thanks,
> Danny
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "modwsgi" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/modwsgi/-/GtqtGNkjqmkJ.
> 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