M
M
Mikhail Kim2017-08-03 16:18:53
Nginx
Mikhail Kim, 2017-08-03 16:18:53

How to set up basic auth and proxy pass?

I want the backend not to deal with basic auth, I want to shift this task to nginx. Here is the config:

server {
  listen 443 ssl default_server;
  server_name myhost.com;
  include /etc/nginx/includes/listen_ssl;
  client_max_body_size 100m;

  location / {
    auth_basic "Restricted Content";
    auth_basic_user_file /storage/server/security/.htpasswd;
    proxy_pass http://127.0.0.1:8080;
  }
}

But when I make a request for / with login and password, Nginx returns 500. Why?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
Boris Korobkov, 2017-08-03
@BorisKorobkov

The answer to your question is in /var/log/nginx/error.log

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question