upstream django_server_random16112.example.org { server unix:/srv/http/random29227/live/website.sock; } server { listen 80; server_name random16112.example.org; location /media/ { alias /srv/http/random29227/live/dynamic/public/; expires 7d; include upload_folder_security_params; } location /static/ { alias /srv/http/random29227/live/static_collected/; expires 7d; } location / { proxy_pass http://django_server_random16112.example.org; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } access_log /var/log/nginx/random29227/live/access.log combined_plus; error_log /var/log/nginx/random29227/live/error.log; } server { server_name random5297.example.org www.random5297.example.org; server_name random17050.example.org www.random17050.example.org; server_name www.random16112.example.org; return 301 http://random16112.example.org$request_uri; }