upstream django_server_random15255_intern {
  server unix:/srv/http/random15255/intern/website.sock fail_timeout=5;
} 

server {
    listen 80;
    server_name random11459.example.org www.random11459.example.org;

  if ($host != 'random11459.example.org') {
    rewrite  ^/(.*)$  http://random11459.example.org/$1  permanent;
  }
    
    location /media/ {
        alias /srv/http/random15255/internal/dynamic/public/;
        expires 7d;
        include upload_folder_security_params;
    }
    location /static/ {
        alias /srv/http/random15255/internal/static_collected/;
        expires 7d;
    }
    
  location / {
    proxy_pass http://django_server_random15255_intern;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Protocol $scheme;

    satisfy any;
    auth_basic           'random191 internal';
    auth_basic_user_file /srv/http/random15255/internal/htpasswords;
    include              /etc/nginx/allow_ytec_ips_params;
    deny all;
  }

  access_log /var/log/nginx/random15255/internal/access.log combined_plus;
  error_log /var/log/nginx/random15255/internal/error.log;
}
