How to split server that has same name in Nginx

Viewed 74

I'm new to Nginx.

I've created a web server that is listening port 443.

There are some locations. The main thing is that I wanna split those locations because that

It couldn't apply $ssl_verify_client options ( on / optional ) at once.

I know that only $ssl_verify_client options by on can handle with mutual TLS communications. This is why I split it.

apply optional to url b, c

apply on to url only a

I've tried to run configurations like below

server {
  listen 443 ssl;
  servername exam.com;
  ...
  ssl_verify_client on;
  ...
  locations /a {
  }
}

server {
  listen 443 ssl;
  servername exam.com;
  ...
  ssl_verify_client optional;
  ...
  locations /b {
  }
  locations /c {
  }
}

But It doesn't work. How can I solve this problem? I think the server has a same servername

1 Answers

In the location block, try writing:

ssl_verify_client optional;
Related