worker_processes 2; pid /var/run/nginx.pid; # [ debug | info | notice | warn | error | crit ] error_log /var/log/nginx.error_log info; events { worker_connections 2000; } http { include mime.types; default_type application/octet-stream; upstream app_server_djangoapp { server localhost:8080 fail_timeout=0; } server { listen 8000; server_name example.com; add_header X-Content-Type-Options nosniff; access_log /var/log/nginx/guni-access.log; error_log /var/log/nginx/guni-error.log info; keepalive_timeout 5; root /usr/src/app; location /static { autoindex on; alias /static; } #location /media { # autoindex on; # alias /media; #} location / { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_redirect off; proxy_connect_timeout 800; proxy_send_timeout 800; proxy_read_timeout 800; send_timeout 800; if (!-f $request_filename) { proxy_pass http://127.0.0.1:8080; break; } } } }