Nginx (proxy pass) + Nexus 3 (docker)

Hello.
I try next configuration:
I started nexus 3 in the docker container and install nginx service.
My configuration nginx:

server {
listen 443 ssl;
server_name registry.it-lessons.ru;

ssl on;
ssl_certificate "/etc/ssl/certs/nginx-selfsigned.crt";
ssl_certificate_key "/etc/ssl/private/nginx-selfsigned.key";

location ~ (/v1/|/v2/) {
    proxy_set_header Host $host:$server_port;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto "https";
    proxy_pass http://localhost:8081/repository/test1;

    location / {
    proxy_set_header Host $host:$server_port;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto "https";
    proxy_pass http://localhost:8081;
    }

}

I saw configuration there:

But I see nginx configuration error:
[root@registry ~]# nginx -t
nginx: [emerg] “proxy_pass” cannot have URI part in location given by regular expression, or inside named location, or i
nside “if” statement, or inside “limit_except” block in /etc/nginx/conf.d/registry.conf:14
nginx: configuration file /etc/nginx/nginx.conf test failed

What can I change this?

Hi Serogava,
It seems like your configuration file is missing a closing curly brace after on line before location / {.

Thanks you, but it not helped me.