upstream django_server_random3140.example.org { server unix:/srv/http/random2912/live/website.sock; } server { listen 80; server_name random3140.example.org; location ^~ /media/ { alias /srv/http/random2912/live/dynamic/public/; expires 7d; } location ^~ /static/ { alias /srv/http/random2912/live/static_collected/; expires 7d; } location / { proxy_pass http://django_server_random3140.example.org; include /etc/nginx/proxy_params; # You can configure access rules here } access_log /var/log/nginx/random2912/live/access.log combined_plus; error_log /var/log/nginx/random2912/live/error.log; } server { server_name www.random3140.example.org; server_name random28398.example.org; server_name random23689.example.org www.random23689.example.org; server_name random25863.example.org www.random25863.example.org; rewrite ^ http://random3140.example.org$request_uri permanent; }