Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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/ -

-->/www/ -

-->/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 ->

Any advice would be appreciated. Thanks

PS: I have seen the following links:,, but they dont appear to be doing the same thing.

share|improve this question

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

share|improve this answer

I'm currently doing this on my VPS. It's kinda a three step process:

  1. CNAME for my subdomain, this is done in whatever you use to manage your DNS stuff
  2. Virtual host for Ngnix
  3. Virtual host for Apache2

This post was pretty helpful to me: The Django and Ubuntu Intrepid Almanac.

Your DNS entry should look like this: 3600 IN CNAME

In the /etc/nginx/sites-available directory:


In the /etc/apache2/sites-available directory:


Don't forget to add a symbolic link for each of the corresponding sites-enabled directory.

share|improve this answer
I have gotten this far but am unsure about the setup of the single Django project to multiple subdomains. Your saying I can have a single Django project, with multiple applications which have their own subdomain? I must need to have a closer look at the link you posted. Thanks – Mark Stahler Sep 6 '09 at 14:35
you might want to check out – imjoevasquez Sep 6 '09 at 19:31
Django Sites does not do what I am trying to do. – Mark Stahler Sep 7 '09 at 2:24
up vote 0 down vote accepted

I have found the solution and it is working quite well. There are a few problems however as some reusable apps (such as django-debug-toobar) have problems with media file paths in the templates. Ofcourse you can modify them to work manually.

Django Multihost Configuration

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.