title: Nginx config: how to use auth_basic authentication if ssl_client_certificate none provided?
body: <p>I'm trying to set up Nginx server as follows:</p>
  
  <p>First, the server should check whether the user provides the client SSL certificate (via <strong>ssl_client_certificate</strong>).
  If the SSL certificate is provided, then give access to the site, </p>
  
  <p>If the SSL certificate is NOT provided, then ask the user to enter a password and logs through <strong>auth_basic</strong>.</p>
  
  <p>I was able to configure both the authentication method <em>at the same time</em>. But this config is superfluous.</p>
  
  <p>To make check, whether the user provides its SSL certificate I try the config like this:</p>
  
  <pre><code>18:    if ($ssl_client_verify != SUCCESS) {
  19:        auth_basic "Please login";
  20:        auth_basic_user_file .passfile;
  21:    }
  </code></pre>
  
  <p>But Nginx returns an error:</p>
  
  <blockquote>
    <p>"auth_basic" directive is not allowed here in .../ssl.conf:19</p>
  </blockquote>
  
  <p>How can I to set the condition in this case?</p>