server { listen 80; server_name dainsleif.dyndns.org; # no security problem here, since / is alway passed to upstream root /home/faisal/projects/disting; # serve directly - analogous for static/staticfiles location /static { alias /static/; } location /admin/media { # this changes depending on your python version root /home/faisal/projects/virtualenvs/disting_env/lib/python2.7/site-packages/django/contrib; } location / { proxy_pass_header Server; proxy_set_header Host $http_host; proxy_redirect off; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Scheme $scheme; proxy_connect_timeout 10; proxy_read_timeout 10; proxy_pass http://localhost:5580/; } # what to serve if upstream is not available or crashes error_page 500 502 503 504 /media/50x.html; }