server {
        listen 80;
        listen [::]:80;
        #server_name <Domain Name>;
        root /var/www;
        
        index index.html index.php index.htm;
        
        error_page 403 = @denied;
        #Below enter IP address or block to allow, eg LAN and/or VPN blocks
        allow 10.0.0.0/8;
        allow 172.16.0.0/12;
        allow 192.168.0.0/16;
        deny all;

        location @denied {
               return 301 https://$host$request_uri;
        }
        
        location / {
               try_files $uri $uri/ =404;
        }

        location /rutorrent {
               auth_basic "Restricted";
               auth_basic_user_file /etc/nginx/.htpasswd;
               include /etc/nginx/conf.d/php;
               include /etc/nginx/conf.d/cache;
        }

        #include /etc/nginx/sites-available/dload-loc;

        location ~ /\.ht {
                deny all;
        }
}

server {
        listen 443 ssl http2 default_server;
        listen [::]:443 ssl http2 default_server;

        #server_name <Domain Name>;

        root /var/www;
        index index.html index.php index.htm;

        client_max_body_size 40m;
        
        ssl_certificate /etc/ssl/ruweb.crt;
        ssl_certificate_key /etc/ssl/private/ruweb.key;
        ssl_session_timeout 5m;
        
        location / {
               try_files $uri $uri/ =404;
        }

        location /rutorrent {
               client_max_body_size 40m;
               auth_basic "Restricted";
               auth_basic_user_file /etc/nginx/.htpasswd;
               include /etc/nginx/conf.d/php;
               include /etc/nginx/conf.d/cache;
        }

        #include /etc/nginx/sites-available/dload-loc;

        location ~ /\.ht {
                deny all;
        }

}
