upstream django_server_random6177.example.org {
    server unix:/srv/http/random550/live/website.sock;
}

server {
    listen 443 ssl;
    server_name random2179.example.org;

    ssl_certificate       /etc/ssl/public/random2179.example.org.bundle.crt;
    ssl_certificate_key   /etc/ssl/private/random2179.example.org.key;


    location /media/ {
        alias /srv/http/random550/live/dynamic/public/;
        expires 7d;
        include upload_folder_security_params;
    }
    location /static/ {
        alias /srv/http/random550/live/static_collected/;
        expires 7d;
    }

    location / {
        proxy_pass http://django_server_random6177.example.org;
        include          /etc/nginx/django_proxy_params;
    }

    access_log /var/log/nginx/random550/live/access.log combined_plus;
    error_log  /var/log/nginx/random550/live/error.log;
}

server {
    listen 80;
    server_name random2179.example.org;

    location /media/ {
        alias /srv/http/random550/live/dynamic/public/;
        expires 7d;
        include upload_folder_security_params;
    }
    location /static/ {
        alias /srv/http/random550/live/static_collected/;
        expires 7d;
    }

    #location = / {
    #    return 301 https://random2179.example.org$request_uri;
    #}

    location / {
        proxy_pass http://django_server_random6177.example.org;
        include          /etc/nginx/django_proxy_params;
    }

    access_log /var/log/nginx/random550/live/access_http.log combined_plus;
    error_log  /var/log/nginx/random550/live/error_http.log;
}

server {
    server_name random6177.example.org www.random6177.example.org;
    return 301 http://random2179.example.org$request_uri;
}
