upstream django_server_random1769.example.org {
    server unix:/srv/http/random7047/acceptance/website.sock;
}

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

    if ($host != 'random1769.example.org') {
        rewrite  ^/(.*)$  http://random1769.example.org/$1  permanent;
    }

    rewrite ^/(.*) https://$host:443/$1;
}

server {
    listen 443;
    server_name random1769.example.org;

    ssl on;
    ssl_certificate empty_cert.pem;
    ssl_certificate_key key2.pem;

    location ^~ /media/ {
        alias /srv/http/random7047/acceptance/dynamic/public/;
        expires 7d;
    }
    location ^~ /static/ {
        alias /srv/http/random7047/acceptance/static_collected/;
        expires 7d;
    }

    location / {
#        proxy_pass http://django_server_random1769.example.org;
        include          /etc/nginx/proxy_params;

        #satisfy any;
        #auth_basic           'acceptance for random7047';
        #auth_basic_user_file /srv/http/random7047/acceptance/htpasswords;
        #include              /etc/nginx/allow_ytec_ips_params;
        #deny all;
    }

    access_log /var/log/nginx/access_log combined;
    error_log  /var/log/nginx/error_log;
}
