Q:

What's wrong with url matching in "location" tag?

It's my first experience of using nginx on Debian. 
So, I have a html-page that placed in /var/www/gis/index.html
I configured nginx as:
server {
        listen 80;
        listen 443 ssl http2;
        listen [::]:443 ssl http2;
        server_name localhost;

        ssl_certificate /etc/ssl/certs/localhost.crt;
        ssl_certificate_key /etc/ssl/private/localhost.key;

        ssl_protocols TLSv1.2 TLSv1.1 TLSv1;

        location / {

        root /var/www/gis;
        index index.html;

        }

And I can see my page if type https://localhost in browser. 
But if I change location tag to
        location /gis {  ## or location = /gis ##)

        root /var/www/gis;
        index index.html;

        }

I expect to get my site at https://localhost/gis/, but error 404 appears. What I did wrong?

A:

With this configuration, nginx expects to find your index.html at /var/www/gis/gis/. You can use either
location /gis {
    root /var/www;
    index index.html;
}

or
location /gis {
    alias /var/www/gis;
    index index.html;
}

