upstream staging_server { server 127.0.0.1:9000 fail_timeout=1; } server { listen 80; client_max_body_size 4G; server_name dev.newsblur.com; if (-f /srv/staging/media/maintenance.html) { rewrite ^(.*) http://www.newsblur.com; break; } location /media/admin/ { alias /usr/local/lib/python2.6/dist-packages/django/django/contrib/admin/media/; } location /media/ { expires max; root /srv/staging; } location /favicon.ico { alias /srv/staging/media/img/favicon_32.png; expires max; access_log off; } location ^~ /crossdomain.xml { expires max; alias /srv/staging/media/crossdomain.xml; types { text/x-cross-domain-policy xml; } } 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://staging_server; break; } } }