Django Setup – One project, multiple subdomains with Nginx + Apache2

apache-2.2djangosubdomain

I am using Nginx as a front end web server redirecting Python requests to Apache + mod_wsgi. Everything with that is working fine. I have one Django project running and I want to setup subdomains for a few of my project apps.

Proposed structure:

/www/project/ –

–>/admin/ – admin.domain.com

–>/www/ – www.domain.com

–>/common_data/ – no subdomain

–> etc

Where is this setup done? Apache or is it done within Django? Is an Apache rewrite rule the best way to do this? I would prefer to maintain urls in the browser window. ie http://domain.com/admin/filebrowser/browse/ -> http://admin.domain.com/filebrowser/browse/.

Any advice would be appreciated. Thanks

PS: I have seen the following links: http://www.djangosnippets.org/snippets/1119/, http://sharjeel.2scomplement.com/2008/07/24/django-subdomains/, http://www.rossp.org/blog/2007/apr/28/using-subdomains-django/ but they dont appear to be doing the same thing.

Best Answer

Set up multiple <VirtualHost>s in Apache, and point each one to a different DocumentRoot.

Related Topic