upstream app_server { server 127.0.0.1:12000 fail_timeout=0; } server { listen 80; listen [::]:80 ipv6only=on; server_name dpaste.de dpaste.org; error_log /srv/dpaste.de/var/nginx.error.log; keepalive_timeout 5; client_max_body_size 4G; location /media/ { alias /srv/dpaste.de/var/media/; } location /static/ { alias /srv/dpaste.de/var/static/; } location / { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_redirect off; proxy_buffering off; if (!-f $request_filename) { proxy_pass http://app_server; break; } } }