Are there any good Nginx configuration with Basic Authentication


As the title mention, are there any good configuration for reference?

Or, if you have configured Nginx with Bacis Authentication, however, you don’t make it work.

I want to know something about this topic.

Without Bacis Authentication, it is ok to work. But, I add Basic Authentication feature to Nginx configuration. I can’t use git clone and I guess git push failure to do either.

The wrong is 401.

< HTTP/1.1 401 Unauthorized

< Server: nginx/1.14.2

< Date: Sun, 06 Jan 2019 10:44:10 GMT

< Content-Type: text/html

< Content-Length: 195

< Connection: keep-alive

  • Authentication problem. Ignoring this.

< WWW-Authenticate: Basic realm=“Restricted Content”