I am using mod_wsgi in a virtualenv with Apache 2.4 and I want to serve multiple Django sites from the same server.
httpd.config
### Configuration Site_1
LoadModule wsgi_module " S:/Site_1/VirtualEnvSite_1/Lib/site-packages/mod_wsgi/server/mod_wsgi.cp36-win_amd64.pyd"
WSGIApplicationGroup %{GLOBAL}
WSGIPythonHome "c:/users/mmyuser/appdata/local/programs/python/python36"
WSGIScriptAlias / " S:/Site_1/site_1/site_1/wsgi_windows.py"
WSGIPythonPath " S:/Site_1/VirtualEnvSite_1/Lib/site-packages"
Alias /static " S:/Site_1/site_1/staticfiles"
Alias /media " S:/Site_1/site_1/media"
<Directory " S:/Site_1/site_1/staticfiles">
Require all granted
</Directory>
<Directory " S:/Site_1/site_1/media">
Require all granted
</Directory>
<Directory " S:/Site_1/site_1/PEQ">
<Files wsgi_windows.py>
Require all granted
</Files>
</Directory>
####Configuration Site_2
LoadModule wsgi_module " S:/Site_2/VirtualEnvSite_2/lib/site-packages/mod_wsgi/server/mod_wsgi.cp36-win_amd64.pyd"
WSGIApplicationGroup %{GLOBAL}
WSGIPythonHome "c:/users/myuser/appdata/local/programs/python/python36"
WSGIScriptAlias / " S:/Site_2/site_2/site_2/wsgi_windows.py"
WSGIPythonPath " S:/Site_2/VirtualEnvSite_2/Lib/site-packages"
Alias /static " S:/Site_2/site_2/staticfiles"
Alias /media " S:/Site_2/site_2/media"
<Directory " S:/Site_2/site_2/staticfiles">
Require all granted
</Directory>
<Directory " S:/Site_2/site_2/media">
Require all granted
</Directory>
<Directory " S:/Site_2/site_2/site_2">
<Files wsgi_windows.py>
Require all granted
</Files>
</Directory>
httpd-vhosts.config
# Virtual Hosts
#
<VirtualHost *:8080>
ServerAdmin webmaster@localhost
DocumentRoot "c:/wamp/www"
ServerName localhost
ErrorLog "logs/localhost-error.log"
CustomLog "logs/localhost-access.log" common
</VirtualHost>
I have reviewed these posts:
- Deploying multiple django apps on Apache with mod_wsgi
- multiple-django-sites-with-apache-mod-wsgi
- running-multiple-django-projects-on-one-apache-instance-with-mod_wsgi/
- MĂșltiples direcciones, un solo proyecto
- how-to-use-mod-wsgi-for-hosting-multiple-django-projects-under-single-domain
but they have not worked for me.
The server is a Windows Server 2012R2
Please direct me what I should do to get both sites up and running.
Note: The websites work perfectly separate
2
Answers
I also have a similar problem. And I’ve already looked for many posts, one thing I noticed different from yours was the line:
I identify the site in the alias:
And I’m using process daemon:
In my case it’s still not working for some other reason. Which I haven’t identified yet. Individual applications run correctly using reverse proxy. But when I activate both, one of them gives the error:
AH00128: File does not exist: /var/www/html/myapp2/
. Configuration files are identical.Here are my config for setting up multiple projects apache | windows | wsgi
httpd.conf
site1 wsgi.py
site2 wsgi.py