title: How to run Django and Wordpress using Nginx and Gunicorn at the same domain?
body: <p>I have a Django app that is running on a domain e.g. www.example.com</p>
  
  <p>I want to create a Wordpress landing page, and point this landing page to the home url www.example.com and the wordpress admin site to www.example.com/admin or www.example.com/wp-admin. All the other URLs should be served by Django.</p>
  
  <p>So, I want:</p>
  
  <ul>
  <li>www.example.com -> wordpress</li>
  <li>www.example.com/admin or www.example.com/wp-admin -> wordpress</li>
  <li>All the other URLs to be served by Django</li>
  </ul>
  
  <p>Till now, this is my Nginx configuration using Django:</p>
  
  <pre><code>upstream django_server {
      server unix:/path/to/gunicorn.sock fail_timeout=0;
  }
  
  server {
  
      listen   80;
      server_name www.example.com example.com
      client_max_body_size 4G;
  
      access_log /path/to/nginx-access.log;
      error_log /path/to/nginx-error.log;
  
      location /static/ {
          alias   /path/to/static/;
      }
  
      location /media/ {
          alias   /path/to/media/;
      }
  
      location / {
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
          proxy_set_header Host $http_host;
          proxy_redirect off;
          if (!-f $request_filename) {
              proxy_pass http://django_server;
              break;
          }
      }
  
      error_page 500 502 503 504 /500.html;
      location = /500.html {
          root /path/to/static/;
      }
  }
  </code></pre>
  
  <p>Any help would be greatly appreciated.</p>