Sometimes you have certain parts of a web page that should not be accessed via HTTPs and not with clear-text HTTP. Examples for such parts of the website can be management areas of your site, which require you to be authenticated.

If you have such parts of the site, then you can create a redirect that applies only to specific directories of your site:

    server {
            listen 80;
            server_name your-website.com;


            location / {
                   # your configuration for the parts of the website that can be accessed via HTTP
            }

            # redirects for the parts of the web content that should be delivered by HTTPs
            location /<directories_with_https> {
                   return 301 https://$host$request_uri$is_args$args;
            }

            # alternative solution with HTTP status code temporary redirect: 
            location /<directories_with_https> {
                    rewrite  ^ https://your-website.com$request_uri? permanent;
            }
    }
    
    server {
            listen 443;
            server_name your-website.com;

            # rest of your HTTPs configuration
    }