Example from nginx for Windows documentation, chapter 9.
http {
map $request_uri $requri {
default 1;
/ 0;
}
……………………
server {
listen 80;
server_name www.mydomain.eu;
root '/webroot/www.mydomain.eu’;
if ($requri) { return 301 https://www.mydomain.eu$request_uri; }
location / {
try_files $uri $uri/ =404;
index index.html index.htm;
}
}
This will allow you to keep root access via plain HTTP but redirect everything else to HTTPS.
You will need to adjust it for your purpose but the idea behind it will work for what you want.
---
nginx for Windows http://nginx-win.ecsds.eu/