简体   繁体   中英

Multiple Domains for one Django App, with and without SSL

I want to point multiple Domains (each with and whitout ssl) to a single Django App, using mod_wsgi with Apache 2.

I already know how to set up Django to support multiple Domains, but I do not know how to set up Apache properly. If the sites didn't have to use SSL, I would use "ServerAlias"-directives for all relevant domains. But since the domains have to be accessed with and without using SSL, I don't know how to forward both ports for all domains to one single Django App. Google only shows results for redirecting all domains to one single domain.

If they are using exact same code base, and same Django settings module etc, then set them up as if they are different applications, but at global scope in Apache configuration add:

WSGIDaemonProcess all-django-sites

and then in each VirtualHost add:

WSGIProcessGroup all-django-sites
WSGIApplicationGroup %{GLOBAL}

This will cause mod_wsgi to create a daemon process group with all requests handled by single Django instance running in that.

If you code base and settings are different then you can't do this as you can't run more than one Django instance in same interpreter.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM