title: Django nginx admin media
body: <p>I am currently testing moving from <code>Apache mod_wsgi</code> to <code>Nginx and FastCGI</code></p>
  
  <p>I have prepared the whole installation and currently testing it on a <code>CentOS 5.4 box</code> that runs <code>Django 1.1.2</code></p>
  
  <p>In my old <code>Apache configuration</code> I had and alias setup for <code>/media/</code> and also one called <code>/mediaadmin/</code></p>
  
  <p><strong>Which is displayed below.</strong></p>
  
  <pre><code>Alias /media/ "/www/django_test1/omu2/media/"
  &lt;Directory "/www/django_test1/omu2/media"&gt;
  
  Alias /mediaadmin/ "/opt/python2.6/lib/python2.6/site-packages/django/contrib/admin/media/"
  &lt;Directory "/opt/python2.6/lib/python2.6/site-packages/django/contrib/admin/media"&gt;
  </code></pre>
  
  <p>How do I get the same type of setup for Nginx configuration, currently here is a snippet of what I have, even after restarting Nginx i still don't see my admin side resolving with the correct CSS, images etc.</p>
  
  <pre><code>server {
      location /media/ {
          root /www/django_test1/omu2;
      }
      location /mediaadmin/ {
          root /opt/python2.6/lib/python2.6/site-packages/django/contrib/admin;
      }
  }
  </code></pre>
  
  <p><strong>My settings.py</strong></p>
  
  <pre><code>BASE_PATH = os.path.dirname(os.path.abspath(__file__))
  BASE_URL = '127.0.0.1'
  
  MEDIA_ROOT = "%s/media/" % BASE_PATH
  MEDIA_URL = "%s/media/" % BASE_URL
  ADMIN_MEDIA_PREFIX = "%s/mediaadmin/" % BASE_URL
  </code></pre>